Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a varbinary column to a DBT model results in addition of a varchar column #437

Open
1 task done
shahulp opened this issue Oct 1, 2024 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@shahulp
Copy link

shahulp commented Oct 1, 2024

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?

  • Yes I am willing to submit a PR!
@shahulp shahulp added the bug Something isn't working label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant