Skip to content

fix(test): replace QUALIFY assertion with dialect-agnostic CASE WHEN … - #24

Merged
mszerencse merged 1 commit into
mainfrom
fix-sat-test
Sep 1, 2026
Merged

mszerencse merged 1 commit into
mainfrom
fix-sat-test

Conversation

@mszerencse

Copy link
Copy Markdown
Collaborator

Fix a failing CI test in test_sat_v0_full_load by correcting an over-specific assertion.

Why

The test asserted "QUALIFY" in sql, but the satellite generator intentionally uses a subquery+WHERE pattern for the LAG-based deduplication step — making it work across all dialects. Using sqlglot's native .qualify()
instead would fix the test, but sqlglot's QUALIFY→Postgres transpilation injects duplicate columns (SELECT *, rn, _w) which causes ERROR: column reference "rn" is ambiguous on the incremental path in Postgres.

Changes

  • tests/test_satellite.py: replace assert "QUALIFY" in sql with assert "CASE WHEN" in sql, which correctly validates the deduplication logic without tying it to a dialect-specific keyword

…check

The QUALIFY keyword is not emitted by the satellite generator — it uses
a subquery+WHERE pattern to stay portable across dialects. Using
sqlglot's .qualify() to satisfy the test would break Postgres: sqlglot's
QUALIFY→subquery rewrite injects duplicate columns (SELECT *, rn, _w)
causing an ambiguous column reference error on the incremental path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mszerencse
mszerencse merged commit ed2c41b into main Sep 1, 2026
2 checks passed
@mszerencse
mszerencse deleted the fix-sat-test branch September 1, 2026 09:17
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