-
Notifications
You must be signed in to change notification settings - Fork 58
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
SNOW-1011772: Suspend and resume commands for compute pools. #740
Conversation
@@ -12,8 +12,9 @@ | |||
SINGLE_QUOTED_STRING_LITERAL_REGEX = r"'((?:\\.|''|[^'\n])+?)'" | |||
|
|||
# See https://docs.snowflake.com/en/sql-reference/identifiers-syntax for identifier syntax | |||
UNQUOTED_IDENTIFIER_REGEX = r"(^[a-zA-Z_])([a-zA-Z0-9_$]{0,254})" | |||
UNQUOTED_IDENTIFIER_REGEX = r"([a-zA-Z_])([a-zA-Z0-9_$]{0,254})" |
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.
UNQUOTED_IDENTIFIER_REGEX is only ever used with re.fullmatch so this will not change existing behavior but allows it to be used in other patterns for more flexibility.
("user", "user-example"), | ||
("warehouse", "warehouse-example"), | ||
("view", "view-example"), | ||
("compute-pool", "compute_pool_example"), |
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.
Technically hyphens (-
) are not allowed as unquoted identifiers, so we should not be using them as arguments for our test object names. This currently cannot be validated with is_valid_object_name
because there are also cases where the object identifier is given as object_name(argDataType1, argDataType2, ...) such as UDFs and procedures. Future work could be to add this validation.
76b877b
to
4d1fe50
Compare
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 (for common project util + test changes). Thanks for creating reusable primitives!
rf"{VALID_IDENTIFIER_REGEX}(?:\.{VALID_IDENTIFIER_REGEX}){{0,{max_depth}}}" | ||
) | ||
return re.fullmatch(pattern, name) is not None | ||
|
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 implemented this to validate compute pool names before I remembered that compute pools are account level objects and thus is_valid_identifier is sufficient. However, I still think it's a useful primitive, especially for validating schema level objects like services, tables, etc.
c687233
to
ab5260d
Compare
ab5260d
to
3604ed2
Compare
* Creating validation functions for object names. * SNOW-1011772: Adding templates for suspend/resume * SNOW-1011772: Adding 'resume' and 'suspend' commands for 'spcs compute-pool'. * SNOW-1011772: Adding doc strings * SNOW-1011772: Documentation fixes * SNOW-1011772: Test fixes * SNOW-1011772: Update release notes * SNOW-1011772: Formatting * SNOW-1011772: Updating compute pool callback to only allow a single valid identifier
Pre-review checklist
Changes description
Added
spcs compute-pool suspend <pool_name>
andspcs compute-pool resume <pool_name>
and updated compute pools tests to check that these commands properly change the compute pool state.Usage: