File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -101,9 +101,11 @@ def output_name(self) -> str:
101101 return self .this .name
102102
103103
104- class StagedFilePath (exp .Table ):
104+ class StagedFilePath (exp .Expression ):
105105 """Represents paths to "staged files" in Snowflake."""
106106
107+ arg_types = exp .Table .arg_types .copy ()
108+
107109
108110def _parse_statement (self : Parser ) -> t .Optional [exp .Expression ]:
109111 if self ._curr is None :
@@ -409,7 +411,7 @@ def _parse_types(
409411# See: https://docs.snowflake.com/en/user-guide/querying-stage
410412def _parse_table_parts (
411413 self : Parser , schema : bool = False , is_db_reference : bool = False
412- ) -> exp .Table :
414+ ) -> exp .Table | StagedFilePath :
413415 index = self ._index
414416 table = self .__parse_table_parts (schema = schema , is_db_reference = is_db_reference ) # type: ignore
415417
Original file line number Diff line number Diff line change @@ -5371,3 +5371,16 @@ def test_trailing_comments():
53715371 model = load_sql_based_model (expressions , path = Path ("./examples/sushi/models/test_model.sql" ))
53725372 assert not model .render_pre_statements ()
53735373 assert not model .render_post_statements ()
5374+
5375+
5376+ def test_staged_file_path ():
5377+ expressions = d .parse (
5378+ """
5379+ MODEL (name test, dialect snowflake);
5380+
5381+ SELECT * FROM @a.b/c/d.csv(FILE_FORMAT => 'b.ff')
5382+ """
5383+ )
5384+ model = load_sql_based_model (expressions )
5385+ query = model .render_query ()
5386+ assert query .sql (dialect = "snowflake" ) == "SELECT * FROM @a.b/c/d.csv (FILE_FORMAT => 'b.ff')"
You can’t perform that action at this time.
0 commit comments