Skip to content

Replace engine.connect() with engine.begin() #3733

@MoralCode

Description

@MoralCode

As notedin #3716:

In SQLAlchemy 2.0 engine.connect() uses autobegin but NOT autocommit. Every call to update_issue_closed_cntrbs_by_repo_id was rolling back at context-manager exit, leaving cntrb_id stale. Switching to engine.begin() makes the transaction commit on success and roll back only on exception, which is the correct behavior.

We should audit all of our engine.connect() calls and slowly replace them with engine.begin() on a one-by one basis. (one PR per replacement so it can be evaluated, especially for newcomers.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions