dbt is incorrectly altering my table structure

dbt is changing the definition of my database tables while this is not required. I can see it is trying to execute an ALTER statement to change the type of a column from VARCHAR(255) to VARCHAR(500), although the maximum length of the source column is 98 characters so this is not even required.

I can see why dbt is doing this, because it creates a temporary view based on the model definition and uses this view to insert the data into a temporary table. This table is created with a SELECT * INTO statement, so it leaves the table definition to Azure SQL Server. Then it compares the table definition of this new temporary table to the existing table in the data warehouse (manually created with a DDL) and detects a difference, which dbt thinks it needs to resolve.

I would like to avoid this all together and tell dbt to leave the structure of existing tables alone. The tables have been created with a custom DLL after careful consideration and I know for sure that all source data will fit into these tables. My question is how do I tell dbt to not change the table definitions but just move the data from A to B?

NB: All model materializations are set to “incremental”, so dbt is not dropping and recreating the entire table every time a model is run.

I’m running dbt version 1.3.2 and connection to Azure SQL Server

Did you got any solution for this issue

I am also experiencing the issue where dbt is performing unwanted alterations on column lengths in Snowflake.
If anyone has insights, workarounds, or potential solutions, I would greatly appreciate your input.

Am experiencing same issue with dbt. Can someone please share any solutions we have