Skip to content

Commit 9ee991b

Browse files
authored
Fix browser authentication issue (#5)
1 parent 82f5081 commit 9ee991b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: target_snowflake/connector.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ def create_engine(self) -> Engine:
192192
connect_args=connect_args,
193193
echo=False,
194194
)
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
200200
return engine
201201

202202
def prepare_column(

0 commit comments

Comments
 (0)