Snowflake: Add support for CREATE USER#1950
Merged
iffyio merged 2 commits intoapache:mainfrom Jul 23, 2025
Merged
Conversation
iffyio
reviewed
Jul 21, 2025
| #[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] | ||
| #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
| #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] | ||
| pub struct CreateUser { |
Contributor
There was a problem hiding this comment.
Could we add a description and link to the snowflake docs here as well? I think its usually more visible on the struct than on the enum variant since the struct is usually referenced in different contexts
| } | ||
| } | ||
|
|
||
| pub fn parse_create_user(&mut self, or_replace: bool) -> Result<Statement, ParserError> { |
Contributor
There was a problem hiding this comment.
Suggested change
| pub fn parse_create_user(&mut self, or_replace: bool) -> Result<Statement, ParserError> { | |
| fn parse_create_user(&mut self, or_replace: bool) -> Result<Statement, ParserError> { |
| Ok(options) | ||
| } | ||
|
|
||
| // Parses a `KEY = VALUE` construct based on the specified key |
Contributor
There was a problem hiding this comment.
Suggested change
| // Parses a `KEY = VALUE` construct based on the specified key | |
| /// Parses a `KEY = VALUE` construct based on the specified key |
Comment on lines
+16594
to
+16606
| if self.parse_keyword(Keyword::TRUE) { | ||
| Ok(KeyValueOption { | ||
| option_name: key.value, | ||
| option_type: KeyValueOptionType::BOOLEAN, | ||
| value: "TRUE".to_string(), | ||
| }) | ||
| } else if self.parse_keyword(Keyword::FALSE) { | ||
| Ok(KeyValueOption { | ||
| option_name: key.value, | ||
| option_type: KeyValueOptionType::BOOLEAN, | ||
| value: "FALSE".to_string(), | ||
| }) | ||
| } else { |
Contributor
There was a problem hiding this comment.
would something like this be equivalent and simplify the if/elseif branches?
if let Some(kw) = self.parse_one_of_keywords(&[Keyword::TRUE, Keyword::FALSE]) {
Ok(KeyValueOption{ ..., kw.to_string() })
} else {
// ...
}|
|
||
| #[test] | ||
| fn parse_create_user() { | ||
| verified_stmt("CREATE USER u1"); |
Contributor
There was a problem hiding this comment.
Can we include in one of the scenarios an assertion on the returned AST?
b67b0dd to
f97efc2
Compare
iffyio
approved these changes
Jul 23, 2025
Contributor
iffyio
left a comment
There was a problem hiding this comment.
LGTM! Thanks @yoavcloud!
cc @alamb
ayman-sigma
pushed a commit
to sigmacomputing/sqlparser-rs
that referenced
this pull request
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added support for the
CREATE USERstatement in Snowflake. Enhanced the KeyValueOptions struct with: