Snowflake: Add EXTERNAL VOLUME DDL#2397
Open
sabir-akhadov-localstack wants to merge 4 commits into
Open
Conversation
Snowflake's external-volume statements did not parse. This adds
CREATE [OR REPLACE] EXTERNAL VOLUME [IF NOT EXISTS], ALTER, DROP,
DESCRIBE/DESC and SHOW EXTERNAL VOLUMES.
Example that failed before:
CREATE EXTERNAL VOLUME my_vol STORAGE_LOCATIONS = (
(NAME = 'loc1' STORAGE_PROVIDER = 'S3'
STORAGE_BASE_URL = 's3://bucket/path/'))
Storage locations accept STORAGE_BASE_URL, STORAGE_AWS_ROLE_ARN,
STORAGE_AWS_EXTERNAL_ID and ENCRYPTION in any order after NAME and
STORAGE_PROVIDER, matching real Snowflake; required fields and
duplicates are validated after parsing. All statements round-trip.
621d03b to
1858c13
Compare
Address review feedback by building on existing infrastructure instead of bespoke AST: - Parse storage locations (and the nested ENCRYPTION clause) via Parser::parse_key_value_options, the same path CREATE STAGE uses. Storage locations are now Vec<KeyValueOptions>; the ExternalVolumeStorageLocation and ExternalVolumeEncryption structs and their hand-written Display and parser code are removed. Parsing is syntax-only, so field order is preserved and semantic checks (required STORAGE_BASE_URL, duplicate fields) are left to the consumer. - Route DROP EXTERNAL VOLUME through the generic Statement::Drop machinery via a new ObjectType::ExternalVolume, matching how STAGE/STREAM are handled, and drop the dedicated DropExternalVolume statement variant. - Use expect_keyword_is instead of expect_keyword to match the file's convention, and remove the now-unused option-name keywords. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…mpty locations Address review findings: preserve the DESC/DESCRIBE spelling via a DescribeAlias field so DESC EXTERNAL VOLUME round-trips verbatim like every other DESC form; accept ALLOW_WRITES and COMMENT in either order, matching parse_create_database; reject an empty storage location (STORAGE_LOCATIONS = (()) previously parsed while () was rejected) in both CREATE and ALTER ADD via a shared helper; and use parse_comma_separated instead of a hand-rolled comma loop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Snowflake's external-volume DDL did not parse. This adds
CREATE [OR REPLACE] EXTERNAL VOLUME [IF NOT EXISTS],ALTER,DROP,DESCRIBE/DESCandSHOW EXTERNAL VOLUMES.Example that failed before:
Each storage location is a parenthesized key-value option list parsed generically into the existing
KeyValueOptions, so fields (including the nestedENCRYPTION = (...)list) may appear in any order, matching real Snowflake. Only an empty location is rejected; semantic checks such as the requiredSTORAGE_BASE_URLor duplicate fields are left to the consumer, in line with the parser's permissive stance. The trailingALLOW_WRITESandCOMMENTproperties are accepted in either order. All statements round-trip, including theDESCvsDESCRIBEspelling.See the Snowflake
CREATE EXTERNAL VOLUMEdocs.🤖 Generated with Claude Code