We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c97edc5 commit f7e3109Copy full SHA for f7e3109
cardinal_pythonlib/sqlalchemy/alembic_func.py
@@ -104,10 +104,10 @@ def get_current_revision(
104
version_table: table name for Alembic versions
105
"""
106
engine = create_engine(database_url, future=True)
107
- conn = engine.connect()
108
- opts = {"version_table": version_table}
109
- mig_context = MigrationContext.configure(conn, opts=opts)
110
- return mig_context.get_current_revision()
+ with engine.connect() as conn:
+ opts = {"version_table": version_table}
+ mig_context = MigrationContext.configure(conn, opts=opts)
+ return mig_context.get_current_revision()
111
112
113
def get_current_and_head_revision(
0 commit comments