Adding a varbinary column to a DBT model results in addition of a varchar column #437
Open
1 task done
Labels
bug
Something isn't working
Expected behavior
Given that an incremental model is configured as on_schema_change: add_new_columns
Add a new column of type varbinary to the existing model
DBT alters table by adding a new column of type varbinary
Incremental model build succeeds
Actual behavior
DBT alters table by adding a new column of type varchar(256)
Incremental model build fails as it tries to insert varbinary into a varchar column
Steps To Reproduce
{{ config(materialized=incremental, on_schema_change=add_new_columns) }}
SELECT 'TEST' as varchar
Build it once
then change schema
{{ config(materialized=incremental, on_schema_change=add_new_columns) }}
SELECT 'TEST' as first, CAST('SECOND' as varbinary) as second
Build Fails with TrinoUserError(type=USER_ERROR, name=TYPE_MISMATCH, message="Insert query has mismatched column types error
Trino treats varbinary as a string and returns data_type as varchar(256). Ideally It should have returned the dtype returned by adapter as it is. ( in this case varbinary)
Log output/Screenshots
Model
Operating System
Red Hat Enterprise Linux 9.4 (Plow)
dbt version
1.8
Trino Server version
385
Python version
3.10
Are you willing to submit PR?
The text was updated successfully, but these errors were encountered: