Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Cecylia Bocovich
gettor
Commits
caa003c1
Commit
caa003c1
authored
May 23, 2019
by
Hiro
🏄
Browse files
Revert "Update stats db operations"
This reverts commit
06006013
.
parent
06006013
Changes
1
Hide whitespace changes
Inline
Side-by-side
gettor/utils/db.py
View file @
caa003c1
...
...
@@ -88,18 +88,12 @@ class SQLite3(object):
Update statistics to the database
"""
now_str
=
datetime
.
now
().
strftime
(
"%Y%m%d"
)
# This query isn't the nicest until upsert isn't supported
query
=
"BEGIN;"
\
"INSERT OR IGNORE INTO stats(num_requests, platform, language, "
\
"command, service, date) VALUES (0, ?, ?, ?, ?, ?); "
\
"UPDATE stats SET num_requests = num_requests + 1 WHERE platform=? "
\
"AND language=? AND command=? AND service=? AND date=?; "
\
"COMMIT;"
query
=
"INSERT INTO stats(num_requests, platform, language, command, "
\
"service, date) VALUES (1, ?, ?, ?, ?, ?) ON CONFLICT(platform, "
\
"language, command, service, date) DO UPDATE SET num_requests=num_requests+1"
return
self
.
dbpool
.
runQuery
(
query
,
(
platform
,
language
,
command
,
service
,
now_str
,
platform
,
language
,
command
,
service
,
now_str
)
query
,
(
platform
,
language
,
command
,
service
,
now_str
)
).
addCallback
(
self
.
query_callback
).
addErrback
(
self
.
query_errback
)
def
get_links
(
self
,
platform
,
language
,
status
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment