Skip to content

Commit

Permalink
Merge pull request #160 from jwills/jwills_local_env_needs_default_conn
Browse files Browse the repository at this point in the history
Set a default value for the conn attribute in the case an exception is thrown during init
  • Loading branch information
jwills committed May 2, 2023
2 parents d022d7e + 0e8dd18 commit 315d8be
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dbt/adapters/duckdb/environments/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def cursor(self):

class LocalEnvironment(Environment):
def __init__(self, credentials: credentials.DuckDBCredentials):
# Set the conn attribute to None so it always exists even if
# DB initialization fails
self.conn = None
self.conn = self.initialize_db(credentials)
self._plugins = self.initialize_plugins(credentials)
self.creds = credentials
Expand Down

0 comments on commit 315d8be

Please sign in to comment.