Data & Analytics
dbt Fusion can misread numeric UNPIVOT labels as strings
Diagnose a dbt static analysis error on valid BigQuery UNPIVOT SQL with integer labels.
November 10, 2026
An analytics engineer can get a dbt type error on SQL that BigQuery accepts. In dbt issue 17077, a single-column UNPIVOT uses integer labels such as AS 2020. Fusion strict analysis infers the resulting year label as STRING, then rejects year > 2021; the reporter says BigQuery returns INT64.
Reproduce the type boundary
Reduce the model to two input columns, the UNPIVOT expression and one comparison. Run it in BigQuery, then compile with the same dbt version and strict analysis mode as production. Record the warehouse output type and dbt diagnostic. BigQuery's UNPIVOT syntax allows explicit row-value aliases, including integer labels.
Do not conflate this with a separate issue about the types of multiple value columns. Here the disputed type belongs to the name or label column. That distinction matters when routing a compiler report.
Choose a temporary path deliberately
The reporter found an explicit CAST(year AS INT64) at the comparison as a workaround. Test its compiled and executed behavior on a copy of the model. Alternatively, dbt's static analysis modes let teams decide where findings block a build; reducing strictness should be scoped and recorded rather than applied to the whole project by reflex.
Keep a regression case so the temporary cast can be removed after a verified fix. Business metrics should not wait on a false compiler error indefinitely, but the workaround must remain visible.
Adovo’s view
The warehouse's answer and the compiler's warning are two different facts. Good platform governance keeps both. Isolate the mismatch, preserve the valid model's meaning and make the exception expire when the tool catches up.
