aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/nb.py
diff options
context:
space:
mode:
authorDennis Eriksen <d@ennis.no>2023-02-04 14:18:18 +0100
committerDennis Eriksen <d@ennis.no>2023-02-04 14:18:18 +0100
commiteb5e90aded9a7259ddecc94d9244393fa5abd2e6 (patch)
tree8e166a3bec6435c1490cff04cd704ae847b47eba /scripts/nb.py
parentqueue sleep as variable (diff)
downloadenergyscripts-eb5e90aded9a7259ddecc94d9244393fa5abd2e6.tar.gz
moving some variables around
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)