Commit 4df5ba36 authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files

UPSERT dans postgres

parent 7fd82566
......@@ -174,7 +174,10 @@ def cli(configfile):
host=cfg['postgres']['host'], password=cfg['postgres']['password'], port=cfg['postgres']['port'])
cur = conn.cursor()
execute_values(cur,
"""INSERT INTO dataholdings (network, year, station, channel, quality, type, size, is_permanent, date) VALUES %s""",
"""
INSERT INTO dataholdings (network, year, station, channel, quality, type, size, is_permanent, date) VALUES %s
ON CONFLICT DO UPDATE SET size = EXCLUDED.size;
""",
statistics,
"(%(network)s, %(year)s, %(station)s, %(channel)s, %(quality)s, %(type)s, %(size)s, %(is_permanent)s, %(date)s)")
conn.commit()
......
......@@ -6,7 +6,7 @@ with open('README.md', 'r', encoding='utf-8') as f:
setup(
name='resifdatareporter',
version='0.10.0',
version='0.11.0',
description='Scans the resif data repository and compute metrics. Sends the result in influxdb or postgres',
long_description=readme,
long_description_content_type="text/markdown",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment