[BUG] dbt0101 SyntaxInvalid: alias/table-qualified column references inside Snowflake UNPIVOT IN-list trigger false parser warning
- Dominant language
- Rust
- Stars
- 13.8k
- Forks
- 2.6k
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 56
Description
## Describe the bug
Fusion's static analysis parser raises `[SyntaxInvalid (dbt0101)]: mismatched input '.' expecting one of ',', ')'` when alias-qualified or table-qualified column references (e.g., `alias.column_name`) are used inside a Snowflake `UNPIVOT` `IN`-list. Plain, unqualified column names in the same position parse without any warning.
Snowflake itself accepts qualified references in `UNPIVOT` and executes the query successfully. This is a **parser coverage gap** in Fusion's static analysis — not a deliberate restriction and not a Snowflake limitation.
Reported via internal Zendesk ticket #126532 (Enterprise account). Reproduced in-house by a CSE in a Snowflake Fusion sandbox (dbt Studio).
---
## What version of dbt Fusion is this bug in?
Confirmed in dbt Studio (___.us1.dbt.com). Exact CLI version not captured at time of report; behavior reproduced as of June 2026 under default `baseline` static_analysis mode.
---
## Is this a discrepancy between the dbt Fusion Engine and dbt Core?
- [x] YES
- [ ] NO
---
## To Reproduce
Create the following model in a Fusion-enabled Snowflake project:
```sql
-- repro_unpivot_qualified.sql
-- EXPECTED: [SyntaxInvalid (dbt0101)] warning
{{ config(materialized='view') }}
with budget as (
select 'HomeCare' as region, 100 as october, 150 as november, 120 as december
)
select *
from budget
unpivot (
month_budget_nbr for month_nm in (budget.october, budget.november, budget.december)
) as budget_unpivot
```
Run `dbt compile` or `dbt build --select `.
**Observed output (Problems tab in dbt Studio / compile stderr):**
```
[SyntaxInvalid (dbt0101)]: mismatched input '.' expecting one of ',', ')'
--> models/path/to/repro_unpivot_qualified.sql:14:45
(../target/.lsp/compiled/.../repro_unpivot_qualified.sql:14:45)
```
`dbt compile` completes successfully (non-blocking warning under default `baseline` static_analysis mode). The model builds and runs fine in Snowflake directly.
The warning disappears when qualified references are replaced with plain column names — confirming the issue is in Fusion's parser grammar for the `UNPIVOT` IN-list, not in the underlying SQL logic.
---
## Expected behavior
No `dbt0101` warning. Snowflake's SQL dialect permits alias/table-qualified column references inside `UNPIVOT` `IN`-lists (e.g., `alias.column_name`). Fusion's parser should accept this construct without flagging a syntax error.
---
## Workaround
Resolve any multi-table joins in a CTE first, then apply `UNPIVOT` using plain unqualified column names:
```sql
-- repro_unpivot_cte_unqualified.sql
-- EXPECTED: no dbt0101 warning
{{ config(materialized='view') }}
with budget as (
select 'HomeCare' as region, 100 as october, 150 as november, 120 as december
),
volume as (
select 'HomeCare' as region, 10 as units
),
combined as (
select
budget.region,
budget.october,
budget.november,
budget.december
from budget
join volume on budget.region = volume.region
)
select *
from combined
unpivot (
month_budget_nbr for month_nm in (october, november, december)
) as budget_unpivot
```
This produces no `dbt0101` warning and was confirmed to build successfully (1 Pass, 0 Warn, 0 Error).
Alternatively, setting `static_analysis: off` at the model level suppresses the warning, but this removes all static analysis benefits for that model.
---
## Screenshots / Evidence
- **Warning repro:** dbt Studio Problems tab shows `dbt0101` on the qualified-reference model; `dbt compile` exits successfully
- **Workaround confirmed:** `dbt build --select repro_unpivot_cte_unqualified` → 1 Pass, 0 Warn, 0 Error
- Both reproduced in two independent internal CSE Snowflake Fusion sandboxes
---
## Operating System / Environment
- Adapter: Snowflake
- Reproduced in: dbt Studio (cloud IDE, ____.us1.dbt.com)
- static_analysis mode: `baseline` (default)
Contributor guide
Assessment
This issue has not been assessed yet.