Skip to content

Conversation

yoavcloud
Copy link
Contributor

@yoavcloud yoavcloud commented Sep 17, 2025

This PR adds support for the ALTER USER statement with specific support for the Snowflake options. In addition, the KeyValueOptions struct was refactored:

  1. Used the Value type instead of its custom types for option values
  2. Added support for multi-value options, i.e. KEY=(1,2,3)
  3. Added support for nested key-value options, i.e. KEY=(K1=1, K2=2)

@alamb
Copy link
Contributor

alamb commented Sep 17, 2025

Perhaps this would be a good PR for @yoavcloud to try and merge to ensure the credentials are setup correctly

Comment on lines 42 to 48
impl KeyValueOptions {
/// Returns true iff the options list is empty
pub fn is_empty(&self) -> bool {
self.options.is_empty()
}
}

Copy link
Contributor

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

// 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| {
Copy link
Contributor

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)?

@yoavcloud
Copy link
Contributor Author

@iffyio please take a look, and if OK I'll try to merge using my creds

Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @yoavcloud!

Comment on lines 10582 to 10597
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>,
Copy link
Contributor

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

Copy link
Contributor Author

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.

@yoavcloud
Copy link
Contributor Author

@alamb I don't see the merge option, even though the PR has been approved. Who should I check this with?

@alamb
Copy link
Contributor

alamb commented Sep 24, 2025

@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

@yoavcloud yoavcloud added this pull request to the merge queue Sep 25, 2025
@alamb
Copy link
Contributor

alamb commented Sep 25, 2025

Screenshot 2025-09-25 at 4 00 27 PM

It's working!

Merged via the queue into apache:main with commit a430838 Sep 25, 2025
10 checks passed
@yoavcloud yoavcloud deleted the sf_alter_user branch September 25, 2025 20:13
@yoavcloud
Copy link
Contributor Author

That is soooo cool! Thank you @alamb and @iffyio!

@alamb
Copy link
Contributor

alamb commented Sep 26, 2025

That is soooo cool! Thank you @alamb and @iffyio!

Welcome aboard!

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.

3 participants