Skip to content

Commit 70fee96

Browse files
committed
Fix: Snowflake integration tests
1 parent c7191a7 commit 70fee96

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/core/engine_adapter/integration/test_integration.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import pytz
1616
from sqlglot import exp, parse_one
1717
from sqlglot.optimizer.normalize_identifiers import normalize_identifiers
18+
from sqlglot.optimizer.qualify_columns import quote_identifiers
1819

1920
from sqlmesh import Config, Context
2021
from sqlmesh.cli.project_init import init_example_project
@@ -1954,11 +1955,17 @@ def test_sushi(ctx: TestContext, tmp_path_factory: pytest.TempPathFactory):
19541955
],
19551956
personal_paths=[pathlib.Path("~/.sqlmesh/config.yaml").expanduser()],
19561957
)
1957-
config.before_all = [
1958+
before_all = [
19581959
f"CREATE SCHEMA IF NOT EXISTS {raw_test_schema}",
19591960
f"DROP VIEW IF EXISTS {raw_test_schema}.demographics",
19601961
f"CREATE VIEW {raw_test_schema}.demographics AS (SELECT 1 AS customer_id, '00000' AS zip)",
19611962
]
1963+
config.before_all = [
1964+
quote_identifiers(parse_one(e, dialect=ctx.dialect), dialect=ctx.dialect).sql(
1965+
dialect=ctx.dialect
1966+
)
1967+
for e in before_all
1968+
]
19621969

19631970
# To enable parallelism in integration tests
19641971
config.gateways = {ctx.gateway: config.gateways[ctx.gateway]}
@@ -2883,16 +2890,12 @@ def _run_plan(sqlmesh_context: Context, environment: str = None) -> PlanResults:
28832890
assert plan_1.snapshot_for(model_a).model.view_name in plan_1.schema_metadata.views
28842891
assert plan_1.snapshot_for(model_b).model.view_name in plan_1.schema_metadata.views
28852892

2886-
assert len(plan_1.internal_schema_metadata.tables) == 3
2893+
assert len(plan_1.internal_schema_metadata.tables) == 1
28872894

28882895
assert plan_1.table_name_for(model_a) in plan_1.internal_schema_metadata.tables
2889-
assert plan_1.dev_table_name_for(model_a) in plan_1.internal_schema_metadata.tables
28902896
assert (
28912897
plan_1.table_name_for(model_b) not in plan_1.internal_schema_metadata.tables
28922898
) # because its a managed table
2893-
assert (
2894-
plan_1.dev_table_name_for(model_b) in plan_1.internal_schema_metadata.tables
2895-
) # its dev table is a normal table however
28962899

28972900
assert len(plan_1.internal_schema_metadata.managed_tables) == 1
28982901
assert plan_1.table_name_for(model_b) in plan_1.internal_schema_metadata.managed_tables

0 commit comments

Comments
 (0)