aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/nb.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--scripts/nb.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/nb.py b/scripts/nb.py
index 793b8a5..88d40c5 100644
--- a/scripts/nb.py
+++ b/scripts/nb.py
@@ -51,7 +51,17 @@ with open(temp.name, encoding="utf-8") as csvfile:
csvReader = csv.DictReader(csvfile, delimiter=';')
for item in csvReader:
- values.append((item["TIME_PERIOD"],item["BASE_CUR"],item["QUOTE_CUR"],item["OBS_VALUE"]))
+ values.append((
+ item["TIME_PERIOD"],
+ item["BASE_CUR"],
+ item["QUOTE_CUR"],
+ item["OBS_VALUE"]))
+
temp.close()
-common.dbi(common.sql[common.name], values, verbose=True)
+# SQL
+sql = """ INSERT INTO nbex
+ VALUES(%s, %s, %s, %s)
+ ON CONFLICT (startdate,base_cur,quote_cur) DO NOTHING"""
+
+common.dbi(sql, values, verbose=True)