diff --git a/src/pudl/io_managers.py b/src/pudl/io_managers.py index 5c4db431d4..a8b8512c61 100644 --- a/src/pudl/io_managers.py +++ b/src/pudl/io_managers.py @@ -426,9 +426,8 @@ def __init__( super().__init__(base_dir, db_name, md, timeout) - with self.engine.connect() as conn: - existing_schema_context = MigrationContext.configure(conn) - metadata_diff = compare_metadata(existing_schema_context, self.md) + existing_schema_context = MigrationContext.configure(self.engine.connect()) + metadata_diff = compare_metadata(existing_schema_context, self.md) if metadata_diff: logger.info(f"Metadata diff:\n\n{metadata_diff}") raise RuntimeError(