Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cloud-infrastructure
data-analytics
Commits
0ee18e5a
Commit
0ee18e5a
authored
May 03, 2021
by
Antonin Dvorak
Browse files
sqlite3 - get rid of *args, use only optional argument
parent
fbba87c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
adcern/analyser.py
View file @
0ee18e5a
...
...
@@ -388,7 +388,7 @@ class BaseOutlierAnalyser(ABC):
query
=
'''INSERT OR IGNORE INTO scores
VALUES (?, ?, ?, ?, ?, ?)'''
,
upperbound
=
10
,
row
)
params
=
row
)
conn_score
.
close
()
...
...
adcern/cmd/data_mining.py
View file @
0ee18e5a
...
...
@@ -250,7 +250,7 @@ def save_scores_local_sqlite(analyser,
query
=
'''INSERT OR IGNORE INTO scores
VALUES (?, ?, ?, ?, ?, ?)'''
,
upperbound
=
10
,
row
)
params
=
row
)
conn_score
.
close
()
...
...
@@ -663,7 +663,7 @@ def analysis(module_name, class_name, alias_name, hyperparameters,
query
=
'''INSERT INTO time
VALUES (?, ?, ?, ?, datetime('now', 'localtime'))'''
,
upperbound
=
10
,
[
data_dict_train
[
"date_start"
],
params
=
[
data_dict_train
[
"date_start"
],
data_dict_train
[
"date_end_excluded"
],
algo_name
,
training_time
])
...
...
adcern/cmd/elaborate_scores.py
View file @
0ee18e5a
...
...
@@ -392,7 +392,7 @@ def score_benchmark(folder_scores, hostgroup,
query
=
'''INSERT OR IGNORE INTO auc
VALUES (?, ?, ?, ?, ?, ?)'''
,
upperbound
=
10
,
(
hostgroup
,
algo_name
,
family
,
roc_auc
,
int
(
w
),
end_week
))
params
=
(
hostgroup
,
algo_name
,
family
,
roc_auc
,
int
(
w
),
end_week
))
conn_score
.
close
()
# # CUMULATIVE QUANTITIES
...
...
adcern/sqlite3_backend.py
View file @
0ee18e5a
...
...
@@ -4,7 +4,7 @@ import time
def
modify_db
(
conn
,
query
,
upperbound
=
10
,
*
ar
gs
):
p
ar
ams
=
None
):
"""Wrapper for modifications (INSERT, UPDATE, DELETE or REPLACE) of Sqlite3 database.
Executes given query and commits it - in case of lock it retries the commit
Params
...
...
@@ -15,7 +15,7 @@ def modify_db(conn,
query to run
upperbound: int
number of retries to execute query / commit to db
ar
g
s: array
p
ar
am
s: array
additional arguments for execute query, optional
"""
...
...
@@ -23,8 +23,8 @@ def modify_db(conn,
# retry db execute
for
x
in
range
(
1
,
upperbound
+
1
):
try
:
if
ar
gs
:
c
.
execute
(
query
,
*
ar
g
s
)
if
p
ar
ams
:
c
.
execute
(
query
,
p
ar
am
s
)
else
:
c
.
execute
(
query
)
except
Exception
as
e
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment