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,
|
||||
))
|
||||
|
||||
session.add(Covid19Update(country=summary['CountryCode'],
|
||||
confirmed=summary['TotalConfirmed'],
|
||||
deaths=summary['TotalDeaths'],
|
||||
recovered=summary['TotalRecovered'],
|
||||
last_updated_at=update_time))
|
||||
session.merge(Covid19Update(country=summary['CountryCode'],
|
||||
confirmed=summary['TotalConfirmed'],
|
||||
deaths=summary['TotalDeaths'],
|
||||
recovered=summary['TotalRecovered'],
|
||||
last_updated_at=update_time))
|
||||
|
||||
def loop(self):
|
||||
# noinspection PyUnresolvedReferences
|
||||
|
|
Loading…
Reference in a new issue