SCQs
SCQs

Reputation: 53

DBT Snapshots Erroring With "[42S01][ODBC Driver 18][SQL Server]There is already an object named 'table_name__dbt_tmp' in the database."

When running "DBT snapshot" after the initial run I get the error in the title. The object does already exist as it should, because isn't that the point of DBT snapshots. To check the source table and update the snapshot table if there has been a change to capture slowly changing dimensions?

Am I missing something here and using them incorrectly or is the error arising due the __dbt_tmp part, I cannot find the table with that suffix in the DB?

Full Error: ('42S01', "[42S01] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]There is already an object named 'table_name__dbt_tmp' in the database. (2714) (SQLMoreResults)")

Upvotes: 0

Views: 85

Answers (1)

gurman99
gurman99

Reputation: 1

Snapshot command still creates another table, thus another model that cannot be named the same. Your snapshot should be named differently as in the example from dbt - https://docs.getdbt.com/docs/build/snapshots#add-a-snapshot-to-your-project. Hope this helps

Note: despite what dbt is saying, snapshots will not work for a lot of scd2 cases, they quite literally just capture the snapshot, not the full history.

Upvotes: 0

Related Questions