Skip to content

Instantly share code, notes, and snippets.

@Glukhoff
Created October 20, 2022 08:27
Show Gist options
  • Save Glukhoff/24bdc34c2e75e7a97ffa0fd40edb554f to your computer and use it in GitHub Desktop.
Save Glukhoff/24bdc34c2e75e7a97ffa0fd40edb554f to your computer and use it in GitHub Desktop.
sql = update(TrackedAccounts) \
.where(TrackedAccounts.auth_key == deep_link_key) \
.values(
is_active=True,
chat_id=chat_id,
auth_key=None,
updated_at=datetime.fromisoformat(datetime.now().isoformat()),
).returning(TrackedAccounts.id)
async with db_session() as session:
selection = await session.execute(sql)
returned_id = selection.scalar()
await session.commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment