sqlite doesn't support IF EXISTS for DETACH DATABASE so we check manually. Note that we have to commit before detaching, otherwise sqlite will raise a 'database is locked' error.
This issue was exposed when changing the test suite to use the new framework for dbt-core 1.1.0. The old test suite for 1.0.x isn't raising any errors, but fixing this anyway. It's not clear to me that this ever comes up in real world use cases.
sqlite doesn't support IF EXISTS for DETACH DATABASE so we check manually. Note that we have to commit before detaching, otherwise sqlite will raise a 'database is locked' error.
This issue was exposed when changing the test suite to use the new framework for dbt-core 1.1.0. The old test suite for 1.0.x isn't raising any errors, but fixing this anyway. It's not clear to me that this ever comes up in real world use cases.