diff options
Diffstat (limited to 'scripts/entsoe.py')
-rw-r--r-- | scripts/entsoe.py | 15 |
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) |