Skip to content

feat(snowflake): sync upstream grammar and fix task scripting parse#59

Merged
h3n4l merged 1 commit intomainfrom
codex/parser-patch
Feb 27, 2026
Merged

feat(snowflake): sync upstream grammar and fix task scripting parse#59
h3n4l merged 1 commit intomainfrom
codex/parser-patch

Conversation

@h3n4l
Copy link
Member

@h3n4l h3n4l commented Feb 27, 2026

Summary

  • sync snowflake grammar sources to latest upstream antlr/grammars-v4
  • keep Bytebase-specific compatibility behavior while syncing:
    • allow bare file:// in FILE_PATH
    • keep UNDROP DYNAMIC TABLE
    • keep non-reserved keyword supplementation via build_id_contains_non_reserved_keywords.py
  • fix BYT-3534 parsing gap for Snowflake task scripting bodies in CREATE/ALTER TASK ... AS ...:
    • AS BEGIN ... END
    • AS DECLARE ... BEGIN ... END
  • add regression examples:
    • snowflake/examples/create_pipe.sql
    • snowflake/examples/task_scripting.sql

Test Plan

  • go test ./snowflake -run 'TestSnowflakeSQLParser/examples/create_pipe.sql$' -count=1
  • go test ./snowflake -run 'TestSnowflakeSQLParser/examples/task_scripting.sql$' -count=1
  • go run /tmp/check_byt3534_bytebase.go
  • go test ./snowflake -count=1
  • go test ./...

Copilot AI review requested due to automatic review settings February 27, 2026 09:41
@h3n4l h3n4l merged commit 36e79b3 into main Feb 27, 2026
7 checks passed
@h3n4l h3n4l deleted the codex/parser-patch branch February 27, 2026 09:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 ... END and AS 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.

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