Skip to content

Commit

Permalink
Sort JSON keys for UPSERTs
Browse files Browse the repository at this point in the history
This makes it more likely the UPSERT will be a no-op.
  • Loading branch information
liskin committed May 1, 2024
1 parent cfbc7f2 commit 5934a44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/foursquare_swarm_ical/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def upsert(db: sqlite3.Connection, rows: Iterable[Any], incremental: Union[bool,

def sync(db: sqlite3.Connection, access_token: str, incremental: bool = False) -> None:
rows = (
{'id': checkin['id'], 'createdAt': int(checkin['createdAt']), 'data': json.dumps(checkin)}
{'id': checkin['id'], 'createdAt': int(checkin['createdAt']), 'data': json.dumps(checkin, sort_keys=True)}
for checkin in fetch_checkins(access_token=access_token)
)
upsert(db, rows, incremental=incremental)
Expand Down

0 comments on commit 5934a44

Please sign in to comment.