Skip to content

Commit

Permalink
return early if database is None
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Feb 25, 2022
1 parent ec145b8 commit 0b0b7f9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions superset/migrations/versions/b8d3a24d9131_new_dataset_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,10 @@ def after_insert(target: SqlaTable) -> None: # pylint: disable=too-many-locals
target.database
or session.query(Database).filter_by(id=target.database_id).first()
)
engine: Optional[Engine] = None
if database:
engine = database.get_sqla_engine(schema=target.schema)
conditional_quote = (
engine.dialect.identifier_preparer.quote if engine else lambda x: x
)
if not database:
return
engine = database.get_sqla_engine(schema=target.schema)
conditional_quote = engine.dialect.identifier_preparer.quote

# create columns
columns = []
Expand Down

0 comments on commit 0b0b7f9

Please sign in to comment.