File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -192,11 +192,11 @@ def create_engine(self) -> Engine:
192
192
connect_args = connect_args ,
193
193
echo = False ,
194
194
)
195
- connection = engine .connect ()
196
- db_names = [db [1 ] for db in connection .execute (text ("SHOW DATABASES;" )).fetchall ()]
197
- if self .config ["database" ] not in db_names :
198
- msg = f"Database '{ self .config ['database' ]} ' does not exist or the user/role doesn't have access to it."
199
- raise Exception (msg ) # noqa: TRY002
195
+ with engine .connect () as conn :
196
+ db_names = [db [1 ] for db in conn .execute (text ("SHOW DATABASES;" )).fetchall ()]
197
+ if self .config ["database" ] not in db_names :
198
+ msg = f"Database '{ self .config ['database' ]} ' does not exist or the user/role doesn't have access to it."
199
+ raise Exception (msg ) # noqa: TRY002
200
200
return engine
201
201
202
202
def prepare_column (
You can’t perform that action at this time.
0 commit comments