Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Temperaturverteilung
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
s39174
Temperaturverteilung
Commits
3bdd1fcb
Commit
3bdd1fcb
authored
3 years ago
by
Clemens Berteld
Browse files
Options
Downloads
Patches
Plain Diff
Added some comments
parent
228e01c1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dataacquisition/api.py
+5
-4
5 additions, 4 deletions
dataacquisition/api.py
with
5 additions
and
4 deletions
dataacquisition/api.py
+
5
−
4
View file @
3bdd1fcb
...
...
@@ -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 reas
on
s
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 injecti
on
)
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment