feat(snowflake): sync upstream grammar and fix task scripting parse#59
Merged
feat(snowflake): sync upstream grammar and fix task scripting parse#59
Conversation
rebelice
approved these changes
Feb 27, 2026
There was a problem hiding this comment.
Pull request overview
This PR syncs the Snowflake grammar to the latest upstream antlr/grammars-v4 repository while maintaining Bytebase-specific compatibility behaviors. The main enhancement is fixing BYT-3534 by adding support for Snowflake task scripting bodies in CREATE/ALTER TASK statements.
Changes:
- Syncs Snowflake grammar sources to latest upstream while preserving Bytebase customizations (bare
file://support,UNDROP DYNAMIC TABLE, non-reserved keyword supplementation) - Adds parsing support for task scripting blocks:
AS BEGIN ... ENDandAS DECLARE ... BEGIN ... END - Improves Python build script to handle upstream grammar formatting changes
- Regenerates all Go parser artifacts (visitor, listener, base implementations) with hundreds of new grammar rule methods
Reviewed changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| snowflake/examples/task_scripting.sql | New regression test demonstrating task scripting with BEGIN/END and DECLARE blocks |
| snowflake/examples/create_pipe.sql | New regression test for CREATE PIPE with various stage configurations |
| snowflake/build_id_contains_non_reserved_keywords.py | Enhanced to handle upstream grammar formatting (indentation, comments between rule name and colon) |
| snowflake/snowflakeparser_visitor.go | Auto-generated: adds ~200 new Visit methods for new grammar rules |
| snowflake/snowflakeparser_listener.go | Auto-generated: adds ~200 new Enter/Exit methods for new grammar rules |
| snowflake/snowflakeparser_base_visitor.go | Auto-generated: adds ~200 new Visit method implementations |
| snowflake/snowflakeparser_base_listener.go | Auto-generated: adds ~200 new Enter/Exit method stubs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
snowflakegrammar sources to latest upstreamantlr/grammars-v4file://inFILE_PATHUNDROP DYNAMIC TABLEbuild_id_contains_non_reserved_keywords.pyCREATE/ALTER TASK ... AS ...:AS BEGIN ... ENDAS DECLARE ... BEGIN ... ENDsnowflake/examples/create_pipe.sqlsnowflake/examples/task_scripting.sqlTest Plan
go test ./snowflake -run 'TestSnowflakeSQLParser/examples/create_pipe.sql$' -count=1go test ./snowflake -run 'TestSnowflakeSQLParser/examples/task_scripting.sql$' -count=1go run /tmp/check_byt3534_bytebase.gogo test ./snowflake -count=1go test ./...