Skip to content

Commit 3499734

Browse files
committed
fix bug where a file in schema_directory would get needlessly attached as a schema if it was the main db file
1 parent 0c6ea27 commit 3499734

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dbt/adapters/sqlite/connections.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ def open(cls, connection: Connection):
6161
schemas_and_paths[schema] = os.path.abspath(path)
6262

6363
try:
64+
attached = []
6465
if 'main' in schemas_and_paths:
6566
handle: sqlite3.Connection = sqlite3.connect(schemas_and_paths['main'])
67+
attached.append(schemas_and_paths['main'])
6668
else:
6769
raise FailedToConnectException("at least one schema must be called 'main'")
6870

@@ -74,7 +76,6 @@ def open(cls, connection: Connection):
7476

7577
cursor = handle.cursor()
7678

77-
attached = []
7879
for schema in set(schemas_and_paths.keys()) - set(['main']):
7980
path = schemas_and_paths[schema]
8081
cursor.execute(f"attach '{path}' as '{schema}'")

0 commit comments

Comments
 (0)