aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/entsoe.py
diff options
context:
space:
mode:
authorDennis Eriksen <d@ennis.no>2023-02-04 20:23:14 +0100
committerDennis Eriksen <d@ennis.no>2023-02-04 20:23:21 +0100
commit3c9a54e0958e7c0341e470f508e5fbc6db920388 (patch)
tree3d9cb86bcb6454f6f615c5dc71388ac12c75c434 /scripts/entsoe.py
parentadding variable to env.sample (diff)
downloadenergyscripts-3c9a54e0958e7c0341e470f508e5fbc6db920388.tar.gz
sql-variables in common was stupid. put them where they are used
Diffstat (limited to 'scripts/entsoe.py')
-rw-r--r--scripts/entsoe.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/entsoe.py b/scripts/entsoe.py
index 2a7d6f7..4a136af 100644
--- a/scripts/entsoe.py
+++ b/scripts/entsoe.py
@@ -80,7 +80,18 @@ for area in areas:
time = str(cettime + timedelta(hours = int(item["position"]) - 1))
# append values
- values.append((time, area["name"], item["price.amount"]))
+ values.append((
+ time,
+ area["name"],
+ item["price.amount"]))
+
print("Got " + str(items) + " records")
-common.dbi(common.sql[jobname], values, verbose=True)
+# SQL
+sql = """ INSERT INTO entsoe
+ VALUES(%s, %s, %s)
+ ON CONFLICT (starttime, zone) DO NOTHING"""
+
+
+
+common.dbi(sql, values, verbose=True)