mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
feat: refactor all get_sqla_engine to use contextmanager in codebase (#21943)
This commit is contained in:
@@ -340,8 +340,12 @@ class BigQueryEngineSpec(BaseEngineSpec):
|
||||
if not table.schema:
|
||||
raise Exception("The table schema must be defined")
|
||||
|
||||
engine = cls.get_engine(database)
|
||||
to_gbq_kwargs = {"destination_table": str(table), "project_id": engine.url.host}
|
||||
to_gbq_kwargs = {}
|
||||
with cls.get_engine(database) as engine:
|
||||
to_gbq_kwargs = {
|
||||
"destination_table": str(table),
|
||||
"project_id": engine.url.host,
|
||||
}
|
||||
|
||||
# Add credentials if they are set on the SQLAlchemy dialect.
|
||||
creds = engine.dialect.credentials_info
|
||||
|
||||
Reference in New Issue
Block a user