Using session.merge instead of session.add to handle insert/update logic
This commit is contained in:
parent
3bb4c4434c
commit
77e302cd4b
1 changed files with 5 additions and 5 deletions
|
@ -77,11 +77,11 @@ class Covid19Backend(Backend):
|
||||||
update_time=update_time,
|
update_time=update_time,
|
||||||
))
|
))
|
||||||
|
|
||||||
session.add(Covid19Update(country=summary['CountryCode'],
|
session.merge(Covid19Update(country=summary['CountryCode'],
|
||||||
confirmed=summary['TotalConfirmed'],
|
confirmed=summary['TotalConfirmed'],
|
||||||
deaths=summary['TotalDeaths'],
|
deaths=summary['TotalDeaths'],
|
||||||
recovered=summary['TotalRecovered'],
|
recovered=summary['TotalRecovered'],
|
||||||
last_updated_at=update_time))
|
last_updated_at=update_time))
|
||||||
|
|
||||||
def loop(self):
|
def loop(self):
|
||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
|
|
Loading…
Reference in a new issue