|
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 |
@@ -1954,11 +1955,17 @@ def test_sushi(ctx: TestContext, tmp_path_factory: pytest.TempPathFactory): |
1954 | 1955 | ], |
1955 | 1956 | personal_paths=[pathlib.Path("~/.sqlmesh/config.yaml").expanduser()], |
1956 | 1957 | ) |
1957 | | - config.before_all = [ |
| 1958 | + before_all = [ |
1958 | 1959 | f"CREATE SCHEMA IF NOT EXISTS {raw_test_schema}", |
1959 | 1960 | f"DROP VIEW IF EXISTS {raw_test_schema}.demographics", |
1960 | 1961 | f"CREATE VIEW {raw_test_schema}.demographics AS (SELECT 1 AS customer_id, '00000' AS zip)", |
1961 | 1962 | ] |
| 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 | + ] |
1962 | 1969 |
|
1963 | 1970 | # To enable parallelism in integration tests |
1964 | 1971 | config.gateways = {ctx.gateway: config.gateways[ctx.gateway]} |
@@ -2883,16 +2890,12 @@ def _run_plan(sqlmesh_context: Context, environment: str = None) -> PlanResults: |
2883 | 2890 | assert plan_1.snapshot_for(model_a).model.view_name in plan_1.schema_metadata.views |
2884 | 2891 | assert plan_1.snapshot_for(model_b).model.view_name in plan_1.schema_metadata.views |
2885 | 2892 |
|
2886 | | - assert len(plan_1.internal_schema_metadata.tables) == 3 |
| 2893 | + assert len(plan_1.internal_schema_metadata.tables) == 1 |
2887 | 2894 |
|
2888 | 2895 | 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 |
2890 | 2896 | assert ( |
2891 | 2897 | plan_1.table_name_for(model_b) not in plan_1.internal_schema_metadata.tables |
2892 | 2898 | ) # 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 |
2896 | 2899 |
|
2897 | 2900 | assert len(plan_1.internal_schema_metadata.managed_tables) == 1 |
2898 | 2901 | assert plan_1.table_name_for(model_b) in plan_1.internal_schema_metadata.managed_tables |
|
0 commit comments