Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(SIP-68): handle empty table name during migration #19793

Merged
merged 2 commits into from
Apr 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
from sqlalchemy.sql.expression import and_, or_
from sqlalchemy_utils import UUIDType

from superset import app, db
from superset.connectors.sqla.models import ADDITIVE_METRIC_TYPES_LOWER
from superset.connectors.sqla.utils import get_dialect_name, get_identifier_quoter
from superset.extensions import encrypted_field_factory
Expand All @@ -51,8 +50,6 @@
from superset.utils.core import MediumText

Base = declarative_base()
custom_password_store = app.config["SQLALCHEMY_CUSTOM_PASSWORD_STORE"]
DB_CONNECTION_MUTATOR = app.config["DB_CONNECTION_MUTATOR"]
SHOW_PROGRESS = os.environ.get("SHOW_PROGRESS") == "1"
UNKNOWN_TYPE = "UNKNOWN"

Expand Down Expand Up @@ -577,7 +574,7 @@ def print_update_count():
drivername = (sqlalchemy_uri or "").split("://")[0]
updates = {}
updated = False
if is_physical and drivername:
if is_physical and drivername and expression:
quoted_expression = get_identifier_quoter(drivername)(expression)
if quoted_expression != expression:
updates["expression"] = quoted_expression
Expand Down Expand Up @@ -871,7 +868,7 @@ def reset_postgres_id_sequence(table: str) -> None:

def upgrade() -> None:
bind = op.get_bind()
session: Session = db.Session(bind=bind)
session: Session = Session(bind=bind)
Base.metadata.drop_all(bind=bind, tables=new_tables)
Base.metadata.create_all(bind=bind, tables=new_tables)

Expand Down