WITH serviceEnteries AS (
SELECT
case [PostingType] when 1 then 'Budget' when 2 then 'Actual' when 0 then 'Precalculation' end as PostingType
,OrderNo
, SomeField
Now if in the incremental part are only records that result in 'Budget' lines, the schema of both tables will differ as can be seen here:
This is due to the fact how the Fabric Warehouse engine guesses data types.
dbt will then continue and try to sync these schema's by updating the PostTypefield from varchar(7) to varchar(14)
While it's technically possible it currently fails for some reason:
14:08:44 Changing col type from varchar(7) to varchar(14) in table database: "DWH"
schema: "silver_fin"
identifier: "ServiceEntry"
14:08:44 fabric adapter: Error running SQL: macro alter_column_type
14:08:44 fabric adapter: Rolling back transaction.
14:08:44 On model.mpl_dp.ServiceEntry: ROLLBACK
14:08:44 On model.mpl_dp.ServiceEntry: Close
14:08:44 Compilation Error in model ServiceEntry (models\silver\ServiceEntry.sql)
'tmp_relation' is undefined
> in macro alter_column_type (macros\adapters\columns.sql)
> called by macro materialization_incremental_fabric (macros\materializations\models\incremental\incremental.sql)
> called by model ServiceEntry (models\silver\ServiceEntry.sql)
I have a dbt model like this
Now if in the incremental part are only records that result in 'Budget' lines, the schema of both tables will differ as can be seen here:
This is due to the fact how the Fabric Warehouse engine guesses data types.
dbt will then continue and try to sync these schema's by updating the
PostType
field fromvarchar(7)
tovarchar(14)
While it's technically possible it currently fails for some reason:I'm not sure why it fails to update the type.