duckdb / dbt-duckdb

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

Changing seeds columns fails #91

Closed mk-oliver-s closed 1 year ago

mk-oliver-s commented 1 year ago

If I have seeds that look like this

id,value
1,'hello'
2,'world'

and then change to look like this

id,status
1,'hello'
2,'world'

then I get

00:40:48  Runtime Error in seed so2_status_codes (seeds/status_codes.csv)
00:40:48    Binder Error: Table "so2_status_codes" does not have a column with name "status"

And the table must be manually deleted in order to work around.

jwills commented 1 year ago

well that sucks, I'm sure I can repro that pretty easily... 👀

jwills commented 1 year ago

Yep, easy to repro, but it looks like we match the behavior of other dbt adapters based on my reading of the code here: https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/include/global_project/macros/materializations/seeds/helpers.sql#L33

If you run dbt seed --full-refresh, the error goes away; the issue is that a seed table is only truncate'd by default, not dropped entirely, and it seems like that applies to any of the adapters.

kyleries commented 1 year ago

Indeed, just confirming what @jwills read in the source - the Docs verify that behavior as designed.

mk-oliver-s commented 1 year ago

Ahh ok, cool!

Thanks for quick responses and maintaining this project!! :D