Skip to content

Commit bcedf27

Browse files
committed
Fix: address Snowflake table parsing bug
1 parent 65ed579 commit bcedf27

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

sqlmesh/core/dialect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,9 @@ def _parse_table_parts(
482482
)
483483

484484
table_arg = table.this
485-
name = table_arg.name
485+
name = table_arg.name if isinstance(table_arg, exp.Var) else ""
486486

487-
if isinstance(table_arg, exp.Var) and name.startswith(SQLMESH_MACRO_PREFIX):
487+
if name.startswith(SQLMESH_MACRO_PREFIX):
488488
# In these cases, we don't want to produce a `StagedFilePath` node:
489489
#
490490
# - @'...' needs to parsed as a string template

tests/core/test_dialect.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,3 +699,7 @@ def test_model_name_cannot_be_string():
699699
)
700700

701701
assert "\\'name\\' property cannot be a string value" in str(parse_error)
702+
703+
704+
def test_parse_snowflake_create_schema_ddl():
705+
assert parse_one("CREATE SCHEMA d.s", dialect="snowflake").sql() == "CREATE SCHEMA d.s"

0 commit comments

Comments
 (0)