Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

test: fix SQL binding isolation on DuckDB 1.0 (#11504)

Shahmir Varqhab5cfcbbbc885
diff --git a/tests/_runtime/test_bindings.py b/tests/_runtime/test_bindings.py
index 0005fc2fd7..5cfd7065cb 100644
--- a/tests/_runtime/test_bindings.py
+++ b/tests/_runtime/test_bindings.py
@@ -547,13 +547,11 @@ async def test_preview_cannot_overwrite_an_update_during_rendering(
def isolated_duckdb() -> Iterator[None]:
import duckdb
- previous = duckdb.default_connection()
- with duckdb.connect() as connection:
- duckdb.set_default_connection(connection)
- try:
- yield
- finally:
- duckdb.set_default_connection(previous)
+ duckdb.begin()
+ try:
+ yield
+ finally:
+ duckdb.rollback()
@pytest.mark.usefixtures("isolated_duckdb")