Commit 0ee18e5a authored by Antonin Dvorak's avatar Antonin Dvorak
Browse files

sqlite3 - get rid of *args, use only optional argument

parent fbba87c1
......@@ -388,7 +388,7 @@ class BaseOutlierAnalyser(ABC):
query = '''INSERT OR IGNORE INTO scores
VALUES (?, ?, ?, ?, ?, ?)''',
upperbound = 10,
row)
params = row)
conn_score.close()
......
......@@ -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])
......
......@@ -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
......
......@@ -4,7 +4,7 @@ import time
def modify_db(conn,
query,
upperbound=10,
*args):
params = 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
args: array
params: 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 args:
c.execute(query, *args)
if params:
c.execute(query, params)
else:
c.execute(query)
except Exception as e:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment