-
Notifications
You must be signed in to change notification settings - Fork 653
Snowflake: ALTER USER and KeyValueOptions Refactoring #2035
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
Conversation
Perhaps this would be a good PR for @yoavcloud to try and merge to ensure the credentials are setup correctly |
src/ast/helpers/key_value_options.rs
Outdated
impl KeyValueOptions { | ||
/// Returns true iff the options list is empty | ||
pub fn is_empty(&self) -> bool { | ||
self.options.is_empty() | ||
} | ||
} | ||
|
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.
I'm thinking we could skip the added API and have the caller call value.options.is_empty()
instead? since this is only a thin wrapper might not be worth it
src/parser/mod.rs
Outdated
// Can be a list of values or a list of key value properties. | ||
// Try to parse a list of values and if that fails, try to parse | ||
// a list of key-value properties. | ||
match self.try_parse(|parser| { |
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.
should this use maybe_parse
instead of try_parse
(noticed we're ignoring the error from which on first glance looks unintentional)?
f4eeb3c
to
33dc28f
Compare
@iffyio please take a look, and if OK I'll try to merge using my creds |
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.
LGTM! Thanks @yoavcloud!
pub reset_password: bool, | ||
pub abort_all_queries: bool, | ||
pub add_role_delegation: Option<AlterUserAddRoleDelegation>, | ||
pub remove_role_delegation: Option<AlterUserRemoveRoleDelegation>, | ||
pub enroll_mfa: bool, | ||
pub set_default_mfa_method: Option<MfaMethodKind>, | ||
pub remove_mfa_method: Option<MfaMethodKind>, | ||
pub modify_mfa_method: Option<AlterUserModifyMfaMethod>, | ||
pub set_policy: Option<AlterUserSetPolicy>, | ||
pub unset_policy: Option<UserPolicyKind>, | ||
pub set_tag: KeyValueOptions, | ||
pub unset_tag: Vec<String>, | ||
pub set_props: KeyValueOptions, | ||
pub unset_props: Vec<String>, |
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.
@yoavcloud one thing I realised now with these props, could we add a link tho the snowflake docs individually for them? Thinking so that when new options are inevitably added for other dialects it would be clear where each propery comes from
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.
Unfortunately Snowflake docs doesn't have a link to each, but we can group them all together. I added a comment about that.
33dc28f
to
4e4f88c
Compare
@alamb I don't see the merge option, even though the PR has been approved. Who should I check this with? |
@yoavcloud -- perhaps you need to link your github and apache account. To do so, follow the instructions at gitbox.apache.org |
This PR adds support for the
ALTER USER
statement with specific support for the Snowflake options. In addition, theKeyValueOptions
struct was refactored:Value
type instead of its custom types for option valuesKEY=(1,2,3)
KEY=(K1=1, K2=2)