Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OSUG
RESIF
resif_data_reporter
Commits
4df5ba36
Commit
4df5ba36
authored
May 06, 2020
by
Jonathan Schaeffer
Browse files
UPSERT dans postgres
parent
7fd82566
Changes
2
Hide whitespace changes
Inline
Side-by-side
resifdatareporter/resifdatareporter.py
View file @
4df5ba36
...
...
@@ -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
()
...
...
setup.py
View file @
4df5ba36
...
...
@@ -6,7 +6,7 @@ with open('README.md', 'r', encoding='utf-8') as f:
setup
(
name
=
'resifdatareporter'
,
version
=
'0.1
0
.0'
,
version
=
'0.1
1
.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"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment