From a27f64450c25b93ccb021f1147243cea686eaf2b Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Thu, 16 Apr 2026 18:14:39 -0400 Subject: [PATCH] Address more comments --- ...11-26_33d7e0e21daa_add_semantic_layers_and_views.py | 6 +++--- tests/unit_tests/semantic_layers/models_test.py | 10 ++-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/superset/migrations/versions/2025-11-04_11-26_33d7e0e21daa_add_semantic_layers_and_views.py b/superset/migrations/versions/2025-11-04_11-26_33d7e0e21daa_add_semantic_layers_and_views.py index b230e31a35e..3c167386b33 100644 --- a/superset/migrations/versions/2025-11-04_11-26_33d7e0e21daa_add_semantic_layers_and_views.py +++ b/superset/migrations/versions/2025-11-04_11-26_33d7e0e21daa_add_semantic_layers_and_views.py @@ -41,13 +41,13 @@ revision = "33d7e0e21daa" down_revision = "a1b2c3d4e5f6" -def upgrade(): +def upgrade() -> None: # Create semantic_layers table create_table( "semantic_layers", sa.Column("uuid", UUIDType(binary=True), default=uuid.uuid4, nullable=False), # created_on and changed_on are nullable=True to match AuditMixinNullable - sa.Column("created_on", sa.DateTime(), nullable=True), + sa.Column("created_on", sa.DateTime(), nullable=False), sa.Column("changed_on", sa.DateTime(), nullable=True), sa.Column("name", sa.String(length=250), nullable=False), sa.Column("description", sa.Text(), nullable=True), @@ -154,7 +154,7 @@ def upgrade(): ) -def downgrade(): +def downgrade() -> None: # Restore original constraint with op.batch_alter_table("slices") as batch_op: batch_op.drop_constraint("ck_chart_datasource", type_="check") diff --git a/tests/unit_tests/semantic_layers/models_test.py b/tests/unit_tests/semantic_layers/models_test.py index dc846efcdca..ebc5f4f861d 100644 --- a/tests/unit_tests/semantic_layers/models_test.py +++ b/tests/unit_tests/semantic_layers/models_test.py @@ -328,14 +328,8 @@ def semantic_view(mock_implementation: MagicMock) -> SemanticView: view.cache_timeout = 3600 view.configuration = "{}" - # Mock the implementation property - with patch.object( - SemanticView, - "implementation", - new_callable=lambda: property(lambda self: mock_implementation), - ): - # We need to return the view but the patch won't persist - pass + # Persist mocked implementation on this instance + view.__dict__["implementation"] = mock_implementation return view