File tree Expand file tree Collapse file tree 4 files changed +10
-3
lines changed
Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 4747 "requests" ,
4848 "rich[jupyter]" ,
4949 "ruamel.yaml" ,
50- "sqlglot[rs]~=25.6.0 " ,
50+ "sqlglot[rs]~=25.7.1 " ,
5151 ],
5252 extras_require = {
5353 "bigquery" : [
Original file line number Diff line number Diff line change @@ -418,7 +418,10 @@ def _parse_table_parts(
418418
419419 if isinstance (table_arg , exp .Var ) and name .startswith (SQLMESH_MACRO_PREFIX ):
420420 # Macro functions do not clash with the staged file syntax, so we can safely parse them
421- if self ._prev .token_type == TokenType .STRING or any (ch in name for ch in ("(" , "{" )):
421+ from sqlmesh .core .macros import macro
422+
423+ macros = macro .get_registry ()
424+ if self ._prev .token_type == TokenType .STRING or "{" in name or name [1 :].lower () in macros :
422425 self ._retreat (index )
423426 return Parser ._parse_table_parts (self , schema = schema , is_db_reference = is_db_reference )
424427
Original file line number Diff line number Diff line change @@ -298,7 +298,7 @@ def test_parse():
298298 dialect snowflake
299299 );
300300
301- SELECT a FROM @if (true, m2, m3)
301+ SELECT a FROM @If (true, m2, m3)
302302 """ ,
303303 )
304304 assert len (expressions ) == 2
Original file line number Diff line number Diff line change @@ -171,6 +171,10 @@ def test_macro_var(macro_evaluator):
171171 # Parsing a "parameter" like Snowflake's $1 should not produce a MacroVar expression
172172 e = parse_one ("select $1 from @path (file_format => bla.foo)" , read = "snowflake" )
173173 assert e .find (exp .Parameter ) is e .selects [0 ]
174+ assert e .find (StagedFilePath )
175+ # test no space
176+ e = parse_one ("select $1 from @path(file_format => bla.foo)" , read = "snowflake" )
177+ assert e .find (StagedFilePath )
174178 assert e .sql (dialect = "snowflake" ) == "SELECT $1 FROM @path (FILE_FORMAT => bla.foo)"
175179
176180 macro_evaluator .locals = {"x" : 1 }
You can’t perform that action at this time.
0 commit comments