Skip to content
Snippets Groups Projects
Commit 3bdd1fcb authored by Clemens Berteld's avatar Clemens Berteld
Browse files

Added some comments

parent 228e01c1
No related branches found
No related tags found
No related merge requests found
......@@ -13,9 +13,9 @@ app.config['TESTING'] = False
@app.route('/', methods=['GET'])
def index():
columns = sql.SQL(' * ')
wheres = sql.SQL('')
values = '' # Gets used in cursor.execute()s' second parameter for safety reasons
columns = sql.SQL(' * ') # columns to be queried (e.g. years)
wheres = sql.SQL('') # where filters
values = '' # Used in second parameter of cursor.execute() (Avoids SQL injection)
if 'id' in request.args:
station_id = request.args['id']
......@@ -41,7 +41,8 @@ def index():
# values = (*values, n) # adding n to existing tuple
query = sql.SQL("SELECT array_to_json(array_agg(row_to_json(t))) from ("
"SELECT {} FROM stations WHERE lon IS NOT NULL "
"SELECT {} FROM stations "
"WHERE lon IS NOT NULL " # Unnecessary filter, just so the real filters can always be written with AND
"{} "
") t;").format(columns, wheres)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment