duckdb / dbt-duckdb

dbt (http://getdbt.com) adapter for DuckDB (http://duckdb.org)
Apache License 2.0
788 stars 70 forks source link

Add pre-model hook for cleaning up remote temporary table on MotherDuck #375

Closed guenp closed 2 months ago

guenp commented 2 months ago

When a dbt incremental model is run on MotherDuck, the otherwise temporary table is created as a regular table on the server in a dbt_temp schema, and the table is dropped afterwards (see #326). However, if something goes wrong with the dbt run, the table persists. This PR adds the drop_relation call to the pre-model hook such that the "temporary" table is dropped beforehand if it still exists.