Repository navigation
fix(syntax): read more Snowflake object statements as Snowflake does - #214
Merged
Merged
Conversation
…Snowflake does These three kinds fell through to the opaque CREATE text, which accepted every malformed variant Snowflake refuses: a set without FOR or with an unknown target, the wrong policy kind, a property list after the target, an application without FROM, a string package name, USING without VERSION, RELEASE CHANNEL or a path, and PATCH without its number. They now parse as structured objects that keep their kind, source, target and properties. CREATE SET, BACKUP or SNAPSHOT followed by a name and FOR is refused as an incomplete set kind.
…ng decisions Read USING RELEASE CHANNEL against VERSION as a matched flag and build each CreateObject in place, as the repository's layout rules require.
Parse the service ON one search column or with TEXT and VECTOR INDEXES, then an optional PRIMARY KEY and ATTRIBUTES, its properties and AS with a query, instead of accepting any text after the kind. All 133 recorded cases for the two forms now agree with Snowflake, which clears 35 false accepts.
… does Parse a service IN COMPUTE POOL FROM a staged or inline specification or template, with USING arguments for a template, and an application service FROM ARTIFACT REPOSITORY with its PACKAGE and VERSION, then their options with a tag list last. Of 210 recorded cases, 209 now agree with Snowflake, which clears 53 false accepts; the other is a CREATE that names no kind.
…ke does Parse the listing's optional SHARE or APPLICATION PACKAGE, then AS its manifest text or FROM its stage location, then its options, instead of accepting any text after the kind. Of 107 recorded cases, 104 now agree with Snowflake, which clears 44 false accepts; a bare CREATE LISTING keeps its existing path, since no recorded case shows how Snowflake reads it AS a manifest.
… tables Read IN, INPUT, OUT and OUTPUT after a procedure argument's name as its mode, accept a bare word for RUNTIME_VERSION and PACKAGES and a string for ARTIFACT_REPOSITORY, and parse CREATE PROCEDURE SCOPED TEMP TABLE with its columns. This clears 35 recorded false rejects and leaves every recorded function verdict unchanged. Three recorded refusals that combine a mode with DEFAULT and several other options now parse; which part Snowflake refuses is not yet recorded.
Parse a Streamlit app's name, optional FROM source location and its properties instead of keeping the statement as opaque text, which DEFINE refuses. Of 332 recorded cases, 330 now agree with Snowflake: 22 false rejects and 1 false accept are cleared, and ALTER STREAMLIT SET with an empty list remains refused.
A database's or schema's properties are checked word by word and then kept as source text, which DEFINE took for an opaque definition and refused. DEFINE now looks past those checked properties and still refuses any other text node. This clears 37 recorded false rejects.
Parse an alert's properties, tag list and STARTED or SUSPENDED state, then IF ( EXISTS ( <condition> ) ) THEN <action>, or FROM TEMPLATE with its properties, instead of keeping the statement as opaque text. A clone keeps its existing path. Of 400 recorded cases, 397 now agree with Snowflake, which clears 15 false rejects and 14 false accepts; the rest are CREATEs that name no kind.
Parse a data movement rule's TYPE, its MAX_ROWS AS ( ) RETURNS <type> -> <expression> body and a string COMMENT, and accept ALTER DATA MOVEMENT RULE with RENAME TO, SET and UNSET. All 174 recorded data movement cases now agree with Snowflake, which clears 22 false rejects and 2 false accepts.
…cleared Remove the 396 receipt disagreements these parsers now agree with, and re-record the baseline for the obligations they gained.
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.
Why
Recorded Snowflake verdicts show the parser accepting any text after several object kinds, because it kept those statements as opaque text, and refusing documented forms of others. An opaque statement also can't be linted, and DEFINE refuses it.
Changes
Verification
cargo test -p sqlquack-syntax-snowflake, clippy and fensu pass.make check-cipasses on the final head.