Adovo

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.

Continue exploring

Data & Analytics

dbtBigQuery

A dbt Fusion Python UDF may deploy more code than you wrote

Inspect the deployed BigQuery routine body during dbt Fusion migration and compare it with the intended function source.

Read more

Data & Analytics

dbtBigQuery

dbt Fusion rejects a valid BigQuery FORMAT call with six values

Distinguish a dbt static-analysis function limit from a BigQuery SQL error.

Read more

Data & Analytics

dbtBigQuery

dbt v2 BigQuery jobs can ignore the old timeout key

Audit BigQuery profiles during dbt v2 migration so a legacy timeout_seconds key does not leave jobs unbounded.

Read more
Explore data and analytics services →