Skip to content

fix: add Snowflake dialect to SQL parser#2

Merged
atvaccaro merged 2 commits intomainfrom
atvaccaro/fix-auth-type-error
Jan 22, 2026
Merged

fix: add Snowflake dialect to SQL parser#2
atvaccaro merged 2 commits intomainfrom
atvaccaro/fix-auth-type-error

Conversation

@atvaccaro
Copy link

@atvaccaro atvaccaro commented Jan 22, 2026

Summary

Test Results

Statements that work both with and without dialect (baseline)

SQL Result
SELECT * FROM my_table Select ✓
INSERT INTO my_table VALUES (1, 2) Insert ✓
COPY INTO my_table FROM @my_stage Copy ✓
SELECT data:name FROM my_table Select ✓

Statements FIXED by adding dialect="snowflake"

SQL Without dialect With dialect
SELECT data:user.address.city FROM t ParseError → Unknown Select ✓
SELECT data:count::INTEGER FROM t ParseError → Unknown Select ✓
SELECT f.value FROM t, LATERAL FLATTEN(input => data:items) f ParseError → Unknown Select ✓
COPY INTO t FROM @stage PATTERN='*.csv' FILE_FORMAT=(...) ParseError → Unknown Copy ✓
COPY INTO @stage FROM t FILE_FORMAT=(TYPE='PARQUET') ParseError → Unknown Copy ✓
SELECT data:items[0]:name FROM t ParseError → Unknown Select ✓
SELECT * FROM t WHERE data:status::STRING = 'active' ParseError → Unknown Select ✓
SELECT ARRAY_SIZE(data:items) FROM t ParseError → Unknown Select ✓
PUT file:///tmp/data.csv @my_stage ParseError → Unknown Command ✓

Test Plan

  • All 44 tests pass (35 new + 9 existing)
  • Verified parsing of COPY, JSON paths, VARIANT casts, and Snowflake-specific functions
  • 9 SQL patterns now correctly parse with the fix that would have failed before

🤖 Generated with Claude Code

Fixes Snowflake-Labs#161 by specifying dialect='snowflake' when parsing SQL with sqlglot.
This ensures Snowflake-specific syntax (COPY, JSON paths, VARIANT casts, etc.)
is correctly identified rather than classified as 'Unknown'. Also enables pytest
in CI and adds comprehensive test coverage for both basic and Snowflake-specific SQL.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@atvaccaro atvaccaro self-assigned this Jan 22, 2026
- Remove unused pytest import
- Fix spelling: unparseable -> unparsable
- Fix quote style for ruff formatter

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@atvaccaro atvaccaro marked this pull request as ready for review January 22, 2026 23:03
Copy link

@darinim-notion darinim-notion left a comment

Choose a reason for hiding this comment

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

sick

@atvaccaro atvaccaro merged commit c1411be into main Jan 22, 2026
12 checks passed
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.

2 participants