We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f4f0f04 + c9f4171 commit a463752Copy full SHA for a463752
dbt/adapters/sqlite/impl.py
@@ -244,6 +244,11 @@ def timestamp_add_sql(
244
def drop_schema(self, relation: BaseRelation) -> None:
245
super().drop_schema(relation)
246
247
+ # can't detach a databse in the middle of a transaction, so commit first.
248
+ # I wonder if drop_schema() in SQLAdapter should do this, since create_schema() does.
249
+ self.commit_if_has_connection()
250
+
251
# never detach main
252
if relation.schema != 'main':
- self.connections.execute(f"DETACH DATABASE {relation.schema}")
253
+ if self.check_schema_exists(relation.database, relation.schema):
254
+ self.connections.execute(f"DETACH DATABASE {relation.schema}")
0 commit comments