|
15 | 15 | import pytz |
16 | 16 | from sqlglot import exp, parse_one |
17 | 17 | from sqlglot.optimizer.normalize_identifiers import normalize_identifiers |
| 18 | +from sqlglot.optimizer.qualify_columns import quote_identifiers |
18 | 19 |
|
19 | 20 | from sqlmesh import Config, Context |
20 | 21 | from sqlmesh.cli.project_init import init_example_project |
@@ -1914,11 +1915,17 @@ def test_sushi(ctx: TestContext, tmp_path_factory: pytest.TempPathFactory): |
1914 | 1915 | ], |
1915 | 1916 | personal_paths=[pathlib.Path("~/.sqlmesh/config.yaml").expanduser()], |
1916 | 1917 | ) |
1917 | | - config.before_all = [ |
| 1918 | + before_all = [ |
1918 | 1919 | f"CREATE SCHEMA IF NOT EXISTS {raw_test_schema}", |
1919 | 1920 | f"DROP VIEW IF EXISTS {raw_test_schema}.demographics", |
1920 | 1921 | f"CREATE VIEW {raw_test_schema}.demographics AS (SELECT 1 AS customer_id, '00000' AS zip)", |
1921 | 1922 | ] |
| 1923 | + config.before_all = [ |
| 1924 | + quote_identifiers(parse_one(e, dialect=ctx.dialect), dialect=ctx.dialect).sql( |
| 1925 | + dialect=ctx.dialect |
| 1926 | + ) |
| 1927 | + for e in before_all |
| 1928 | + ] |
1922 | 1929 |
|
1923 | 1930 | # To enable parallelism in integration tests |
1924 | 1931 | config.gateways = {ctx.gateway: config.gateways[ctx.gateway]} |
@@ -2847,16 +2854,12 @@ def _run_plan(sqlmesh_context: Context, environment: str = None) -> PlanResults: |
2847 | 2854 | assert plan_1.snapshot_for(model_a).model.view_name in plan_1.schema_metadata.views |
2848 | 2855 | assert plan_1.snapshot_for(model_b).model.view_name in plan_1.schema_metadata.views |
2849 | 2856 |
|
2850 | | - assert len(plan_1.internal_schema_metadata.tables) == 3 |
| 2857 | + assert len(plan_1.internal_schema_metadata.tables) == 1 |
2851 | 2858 |
|
2852 | 2859 | assert plan_1.table_name_for(model_a) in plan_1.internal_schema_metadata.tables |
2853 | | - assert plan_1.dev_table_name_for(model_a) in plan_1.internal_schema_metadata.tables |
2854 | 2860 | assert ( |
2855 | 2861 | plan_1.table_name_for(model_b) not in plan_1.internal_schema_metadata.tables |
2856 | 2862 | ) # because its a managed table |
2857 | | - assert ( |
2858 | | - plan_1.dev_table_name_for(model_b) in plan_1.internal_schema_metadata.tables |
2859 | | - ) # its dev table is a normal table however |
2860 | 2863 |
|
2861 | 2864 | assert len(plan_1.internal_schema_metadata.managed_tables) == 1 |
2862 | 2865 | assert plan_1.table_name_for(model_b) in plan_1.internal_schema_metadata.managed_tables |
|
0 commit comments