From 20a5c908c53a80304d2ce61ce850711402b00b29 Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Wed, 24 Nov 2021 12:02:40 -0800 Subject: [PATCH] Fix migration --- superset/connectors/sqla/models.py | 2 +- .../migrations/versions/b8d3a24d9131_new_dataset_models.py | 4 ++-- tests/unit_tests/datasets/test_models.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py index 8f954edd5fa4b..aa090c64ae1dd 100644 --- a/superset/connectors/sqla/models.py +++ b/superset/connectors/sqla/models.py @@ -2043,7 +2043,7 @@ def after_delete( # pylint: disable=unused-argument session.delete(dataset) @staticmethod - def after_update( # pylint: disable=unused-argument, too-many-branches, too-many-locals + def after_update( # pylint: disable=too-many-branches, too-many-locals, too-many-statements mapper: Mapper, connection: Connection, target: "SqlaTable", ) -> None: """ diff --git a/superset/migrations/versions/b8d3a24d9131_new_dataset_models.py b/superset/migrations/versions/b8d3a24d9131_new_dataset_models.py index efeac8ff4159d..2d21c032cfcdf 100644 --- a/superset/migrations/versions/b8d3a24d9131_new_dataset_models.py +++ b/superset/migrations/versions/b8d3a24d9131_new_dataset_models.py @@ -95,10 +95,10 @@ def upgrade(): sa.Column("table_id", sa.INTEGER(), autoincrement=False, nullable=False), sa.Column("column_id", sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint( - ["column_id"], ["columns.id"], name="sl_table_columns_ibfk_2" + ["column_id"], ["sl_columns.id"], name="sl_table_columns_ibfk_2" ), sa.ForeignKeyConstraint( - ["table_id"], ["tables.id"], name="sl_table_columns_ibfk_1" + ["table_id"], ["sl_tables.id"], name="sl_table_columns_ibfk_1" ), ) diff --git a/tests/unit_tests/datasets/test_models.py b/tests/unit_tests/datasets/test_models.py index 46ac958cf759b..73e69199931f7 100644 --- a/tests/unit_tests/datasets/test_models.py +++ b/tests/unit_tests/datasets/test_models.py @@ -219,7 +219,7 @@ def test_dataset_attributes(app_context: None, session: Session) -> None: session.flush() dataset = session.query(SqlaTable).one() - # If this tests fails because attributes changed, make sure to update + # If this test fails because attributes changed, make sure to update # ``SqlaTable.after_insert`` accordingly. assert sorted(dataset.__dict__.keys()) == [ "_sa_instance_state",