Skip to content

Commit

Permalink
use .begin() instead of .connect() for UPDATE query
Browse files Browse the repository at this point in the history
  • Loading branch information
alastair committed Oct 25, 2022
1 parent 382013d commit c671602
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion critiquebrainz/db/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def update_username(user, new_musicbrainz_id: str):
WHERE id = :cb_id
""".format(", ".join(updates))

with db.engine.connect() as connection:
with db.engine.begin() as connection:
connection.execute(sqlalchemy.text(query), {
"cb_id": user["id"],
"new_musicbrainz_id": new_musicbrainz_id,
Expand Down

0 comments on commit c671602

Please sign in to comment.