aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/nb.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/nb.py')
-rw-r--r--scripts/nb.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/scripts/nb.py b/scripts/nb.py
index 7cb753f..793b8a5 100644
--- a/scripts/nb.py
+++ b/scripts/nb.py
@@ -10,7 +10,7 @@ from datetime import timedelta
from tzlocal import get_localzone
import requests
-from common import dbi
+import common
# I'm not sure I understand Norges Banks json-model. It seems a lot easier to just get the CSV, and convert it to JSON.
apiUrl = "https://data.norges-bank.no/api/data/EXR/B.EUR.NOK.SP?format=csv&locale=en"
@@ -54,5 +54,4 @@ with open(temp.name, encoding="utf-8") as csvfile:
values.append((item["TIME_PERIOD"],item["BASE_CUR"],item["QUOTE_CUR"],item["OBS_VALUE"]))
temp.close()
-
-dbi("INSERT INTO " + pg_table + " VALUES(%s,%s,%s,%s) ON CONFLICT (startdate,base_cur,quote_cur) DO NOTHING", values, verbose=True)
+common.dbi(common.sql[common.name], values, verbose=True)