From what I read in the documentation, even when relations differ, the macro will result in a list of unique columns from all relations and fill things with NULL when necessary. However, that's not what's happening in my case.
Steps to reproduce
model_a.sql
SELECT
2 AS test,
3 AS test2
model_b.sql
SELECT
1 AS test
Expected results
(
SELECT
CAST('''`project.schema.model_a`''' AS STRING) AS _dbt_source_relation,
CAST(test AS INT64) AS test,
CAST(test2 AS INT64) AS test2
FROM model_a
) UNION ALL
(
SELECT
CAST('''`project.schema.model_b`''' AS STRING) AS _dbt_source_relation,
CAST(test AS INT64) AS test,
CAST(NULL AS INT64) AS test2
FROM model_b
)
Actual results
test2 column is not even present in the compiled code
(
SELECT
CAST('''`project.schema.mnodel_a`''' AS STRING) AS _dbt_source_relation,
CAST(test AS INT64) AS test
FROM model_a
) UNION ALL
(
SELECT
CAST('''`project.schema.mnodel_b`''' AS STRING) AS _dbt_source_relation,
CAST(test AS INT64) AS test
FROM model_b
)
From what I read in the documentation, even when relations differ, the macro will result in a list of unique columns from all relations and fill things with NULL when necessary. However, that's not what's happening in my case.
Steps to reproduce
model_a.sql
model_b.sql
Expected results
Actual results
test2 column is not even present in the compiled code
System information
The contents of your
packages.yml
file:Which database are you using dbt with?
The output of
dbt --version
: