Skip to content

Conversation

@romanoff
Copy link
Contributor

@romanoff romanoff commented Jan 16, 2026

Fixed this query for snowflake:

SELECT t.$1, t.$2 FROM @mystage1(file_format => 'myformat', pattern => '.*data.*[.]csv.gz') t

Documentation:
https://docs.snowflake.com/en/user-guide/querying-stage#example-1-querying-columns-in-a-csv-file

Specifically t.$1 part didn't work before

let args = if self.consume_token(&Token::LParen) {
Some(self.parse_table_function_args()?)
} else {
None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a test case that doesn't include table function args?

None
};

let alias = self.maybe_parse_table_alias()?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a test case that doesn't include an alias?

}

/// Parse a Snowflake stage reference as a table factor.
/// Handles syntax like: `@mystage1 (file_format => 'myformat', pattern => '...')`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we link to the documentation that supports this syntax?

&& self.peek_keyword_with_tokens(Keyword::SEMANTIC_VIEW, &[Token::LParen])
{
self.parse_semantic_view_table_factor()
} else if dialect_of!(self is SnowflakeDialect)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need a guard for this I think we would instead use a method on the dialect trait (we're moving away from the dialect_of macro for new code). But I think the guard shouldn't be needed in the first place? so that if we see a SELECT * FROM @foo T we can always accept it regardless of dialect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants