diff options
Diffstat (limited to 'dbstore')
-rw-r--r-- | dbstore/peewee_store.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/dbstore/peewee_store.py b/dbstore/peewee_store.py index 00897d7..89e4b4b 100644 --- a/dbstore/peewee_store.py +++ b/dbstore/peewee_store.py | |||
@@ -52,14 +52,13 @@ def get_poi_by_fsq_id(fsq_id) -> dict: | |||
52 | return {} | 52 | return {} |
53 | 53 | ||
54 | 54 | ||
55 | def create_poi(poi: dict): | 55 | def create_or_update_poi(poi: dict) -> int: |
56 | with db.connection_context(): | 56 | with db.connection_context(): |
57 | poi = Location.create( | 57 | return Location.insert( |
58 | fsq_id=poi["fsq_id"], | 58 | fsq_id=poi["fsq_id"], |
59 | name=poi["name"], | 59 | name=poi["name"], |
60 | locality=poi["locality"], | 60 | locality=poi["locality"], |
61 | region=poi["region"], | 61 | region=poi["region"], |
62 | latitude=poi["latitude"], | 62 | latitude=poi["latitude"], |
63 | longitude=poi["longitude"], | 63 | longitude=poi["longitude"], |
64 | ) | 64 | ).on_conflict_replace().execute() |
65 | poi.save() | ||