Skip to content

Commit

Permalink
Move the secret creation to a connection-level operation instead of a…
Browse files Browse the repository at this point in the history
… cursor-level (aka per-thread) operation
  • Loading branch information
jwills committed Oct 18, 2024
1 parent 02b3b86 commit 0958fa8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dbt/adapters/duckdb/environments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ def initialize_db(
conn.execute(f"install {ext.name} from {ext.repo}")
conn.load_extension(ext.name)

# Create/update secrets on the database
for sql in creds.secrets_sql():
conn.execute(sql)

# Attach any fsspec filesystems on the database
if creds.filesystems:
import fsspec
Expand Down Expand Up @@ -216,9 +220,6 @@ def initialize_cursor(
# to the correct type
cursor.execute(f"SET {key} = '{value}'")

for sql in creds.secrets_sql():
cursor.execute(sql)

# update cursor if something is lost in the copy
# of the parent connection
if plugins:
Expand Down

0 comments on commit 0958fa8

Please sign in to comment.