-
Notifications
You must be signed in to change notification settings - Fork 627
Snowflake: CREATE USER #1950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Snowflake: CREATE USER #1950
Conversation
#[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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
src/parser/mod.rs
Outdated
@@ -4689,6 +4696,32 @@ impl<'a> Parser<'a> { | |||
} | |||
} | |||
|
|||
pub fn parse_create_user(&mut self, or_replace: bool) -> Result<Statement, ParserError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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> { |
src/parser/mod.rs
Outdated
Ok(options) | ||
} | ||
|
||
// Parses a `KEY = VALUE` construct based on the specified key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Parses a `KEY = VALUE` construct based on the specified key | |
/// Parses a `KEY = VALUE` construct based on the specified key |
src/parser/mod.rs
Outdated
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 {
// ...
}
tests/sqlparser_common.rs
Outdated
|
||
#[test] | ||
fn parse_create_user() { | ||
verified_stmt("CREATE USER u1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we include in one of the scenarios an assertion on the returned AST?
b67b0dd
to
f97efc2
Compare
Added support for the
CREATE USER
statement in Snowflake. Enhanced the KeyValueOptions struct with: