duckdb / dbt-duckdb

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

Set a default value for the conn attribute in the case an exception is thrown during init #160

Closed jwills closed 1 year ago

jwills commented 1 year ago

If the DuckDB file is inaccessible for some reason during dbt initialization, you get a spurious exception being thrown like AttributeError: 'LocalEnvironment' object has no attribute 'conn' because the conn attribute of the LocalEnvironment was never set due to the DB file being inaccessible.

Fixing that by always setting the conn attribute to None before we try to connect to the DB file so as not to distract the user with an unhelpful error.