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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
feat: ibis catalogs (#5978)
Kyrre Wahl Kongsgårdd8e2a78a3ea7
diff --git a/marimo/_smoke_tests/sql/ibis_backend_catalog.py b/marimo/_smoke_tests/sql/ibis_backend_catalog.pynew file mode 100644index 0000000000..877e6244e3--- /dev/null+++ b/marimo/_smoke_tests/sql/ibis_backend_catalog.py@@ -0,0 +1,159 @@+# /// script+# requires-python = ">=3.12"+# dependencies = [+# "altair==5.5.0",+# "datafusion==48.0.0",+# "ibis-framework[datafusion,duckdb]==10.8.0",+# "marimo",+# ]+# ///++import marimo++__generated_with = "0.14.16"+app = marimo.App(width="medium")+++def _():+ import ibis+ import marimo as mo++ from ibis import _++ ibis.options.interactive = True+ return ibis, mo++[email protected](hide_code=True)+def _(mo):+ mo.md(r"""# Multi-Catalog Ibis Backend Tests""")+ return++[email protected](hide_code=True)+def _(mo):+ mo.md(r"""## DuckDB Multi-Catalog with Temp Tables""")+ return+++def _(ibis):+ # Create DuckDB connection+ duckdb_con = ibis.duckdb.connect()++ # Create test data using ibis.memtable+ sales_data = ibis.memtable(+ {"product": ["laptop", "mouse", "keyboard"], "price": [1200, 25, 75], "quantity": [10, 100, 50]}+ )++ customer_data = ibis.memtable(+ {"customer_id": [1, 2, 3], "name": ["Alice", "Bob", "Charlie"], "region": ["US", "EU", "APAC"]}+ )++ # Create regular table+ duckdb_con.create_table("sales", obj=sales_data, overwrite=True)++ # Create temp table+ duckdb_con.create_table("temp_customers", obj=customer_data, temp=True, overwrite=True)+ return (duckdb_con,)+++def _(duckdb_con):+ # Query the regular table using Ibis API with deferred API+ sales_table = duckdb_con.table("sales")+ sales_query = (+ sales_table.mutate(total_value=_.price * _.quantity)+ .select(_.product, _.price, _.quantity, _.total_value)+ .order_by(_.total_value.desc())+ )+ return+++def _(duckdb_con):+ # Query the temp table using Ibis API with deferred API+ temp_customers_table = duckdb_con.table("temp_customers")+ temp_query = temp_customers_table.order_by(_.customer_id)+ return++[email protected](hide_code=True)+def _(mo):+ mo.md(r"""## DuckDB Attached Catalogs""")+ return+++def _(duckdb_con, ibis):+ # Attach additional in-memory catalogs using DuckDB's ATTACH+ duckdb_con.raw_sql("ATTACH ':memory:' AS catalog_a")+ duckdb_con.raw_sql("ATTACH ':memory:' AS catalog_b")++ # Create tables in different catalogs using ibis API+ inventory_data = ibis.memtable({"product": ["laptop", "mouse", "keyboard"], "stock": [50, 200, 100]})++ orders_data = ibis.memtable({"order_id": [1, 2, 3], "product": ["laptop", "mouse", "laptop"], "quantity": [2, 1, 1]})++ # Create tables in specific catalogs using dot notation+ duckdb_con.create_table("inventory", obj=inventory_data, database="catalog_a.main", overwrite=True)+ duckdb_con.create_table("orders", obj=orders_data, database="catalog_b.main", overwrite=True)+ return+++def _(duckdb_con):+ # Cross-catalog query using Ibis API with deferred API+ orders_table = duckdb_con.table("orders", database="catalog_b.main")+ inventory_table = duckdb_con.table("inventory", database="catalog_a.main")++ cross_catalog_query = (+ orders_table.join(inventory_table, _.product == inventory_table.product)+ .select(_.order_id, _.product, _.quantity, inventory_table.stock)+ .order_by(_.order_id)+ )++ cross_catalog_query+ return++[email protected](hide_code=True)+def _(mo):+ mo.md(r"""## DataFusion Backend""")+ return+++def _(ibis):+ # Create DataFusion connection+ datafusion_con = ibis.datafusion.connect()++ # Create test data using ibis.memtable+ products_data = ibis.memtable(+ {+ "product_id": [1, 2, 3],+ "name": ["Widget A", "Widget B", "Widget C"],+ "category": ["Electronics", "Tools", "Electronics"],+ }+ )++ # Create table+ datafusion_con.create_table("products", obj=products_data, overwrite=True)+ return (datafusion_con,)+++def _(datafusion_con):+ # Query using Ibis API with deferred API+ products_table = datafusion_con.table("products")+ electronics_query = (+ products_table.filter(_.category == "Electronics").select(_.product_id, _.name, _.category).order_by(_.product_id)+ )++ datafusion_con.create_table("electronics", electronics_query, overwrite=True)+ return+++if __name__ == "__main__":+ app.run()diff --git a/marimo/_sql/engines/ibis.py b/marimo/_sql/engines/ibis.pyindex b4aba85eff..379d3ed534 100644--- a/marimo/_sql/engines/ibis.py+++ b/marimo/_sql/engines/ibis.py@@ -171,30 +171,42 @@ class IbisEngine(SQLConnection["SQLBackend"]):Note: This operation can be performance intensive when fetching full metadata."""- if self.default_database is None:- return []+ # Note: Delegation to DuckDBEngine was attempted but get_databases_from_duckdb()+ # has a bug where it doesn't properly handle empty databases. Reverting to+ # working inline SQL approach.- database_name = self.default_database- if self._resolve_should_auto_discover(include_schemas):- schemas = self._get_schemas(- database=database_name,- include_tables=self._resolve_should_auto_discover(- include_tables- ),- include_table_details=self._resolve_should_auto_discover(- include_table_details- ),- )+ # For other Ibis backends, use original logic+ databases = []++ if hasattr(self._connection, "list_catalogs"):+ database_names = self._connection.list_catalogs()else:- schemas = []+ database_names = [self.default_database]++ for database_name in database_names:+ if self._resolve_should_auto_discover(include_schemas):+ schemas = self._get_schemas(+ database=database_name,+ include_tables=self._resolve_should_auto_discover(+ include_tables+ ),+ include_table_details=self._resolve_should_auto_discover(+ include_table_details+ ),+ )+ else:+ schemas = []- database: Database = Database(- name=database_name,- dialect=self.dialect,- schemas=schemas,- engine=self._engine_name,- )- return [database]+ database: Database = Database(+ name=database_name,+ dialect=self.dialect,+ schemas=schemas,+ engine=self._engine_name,+ )++ databases.append(database)++ return databasesdef _get_schemas(self,@@ -207,9 +219,27 @@ class IbisEngine(SQLConnection["SQLBackend"]):meta_schemas = self._get_meta_schemas()schemas: list[Schema] = []- # TODO handle backends without .list_databases()- for schema_name in self._connection.list_databases():- if schema_name.lower() in meta_schemas:++ # Try to get schemas, with fallback for backends that don't support catalog parameter+ try:+ schema_names = self._connection.list_databases(catalog=database)+ except (TypeError, AttributeError) as e:+ # Backend doesn't support catalog parameter or list_databases method+ LOGGER.debug(+ f"Backend doesn't support catalog-based database listing: {e}"+ )+ try:+ # Fallback: try without catalog parameter+ schema_names = self._connection.list_databases()+ except (TypeError, AttributeError):+ # Backend doesn't support list_databases at all+ LOGGER.debug(+ "Backend doesn't support list_databases, using default schema"+ )+ schema_names = [self.default_schema or "main"]++ for schema_name in schema_names:+ if schema_name and schema_name.lower() in meta_schemas:LOGGER.debug(f"Meta schema found `{schema_name}`. Not displaying schema.")@@ -222,6 +252,7 @@ class IbisEngine(SQLConnection["SQLBackend"]):database=database if database is not None else "",include_table_details=include_table_details,)+# ignore schemas with 0 tablesif len(tables) == 0:LOGGER.debug(@@ -246,9 +277,24 @@ class IbisEngine(SQLConnection["SQLBackend"]):return []try:- table_names = self._connection.list_tables(- database=(database, schema)- )+ # Try tuple format first (works for DuckDB and most backends)+ try:+ table_names = self._connection.list_tables(+ database=(database, schema)+ )+ except (TypeError, Exception):+ # Fallback: try just schema (works for SQLite and other simple backends)+ LOGGER.debug(+ f"Tuple database parameter failed, trying schema only for {database}.{schema}"+ )+ table_names = self._connection.list_tables(database=schema)++ # For DuckDB: filter out temp-only tables when NOT in temp catalog+ if self._is_duckdb_backend() and database.lower() != "temp":+ table_names = self._filter_out_temp_only_tables(+ table_names, schema, database+ )+except Exception:LOGGER.warning(f"Failed to get tables from database {database}", exc_info=True@@ -284,6 +330,49 @@ class IbisEngine(SQLConnection["SQLBackend"]):return tables+ def _is_duckdb_backend(self) -> bool:+ """Check if we're using DuckDB backend."""+ return (+ hasattr(self._connection, "name")+ and self._connection.name == "duckdb"+ )++ def _filter_out_temp_only_tables(+ self, table_names: list[str], schema: str, current_database: str+ ) -> list[str]:+ """Filter out tables that exist ONLY in temp catalog.++ For DuckDB: When querying a non-temp catalog, DuckDB's list_tables includes temp tables.+ We need to filter these out by checking which tables actually exist in the target catalog.++ ref: https://github.com/ibis-project/ibis/blob/324b882057ac3cf2bfec098679719c1c1936a084/ibis/backends/duckdb/__init__.py#L866+ """+ try:+ # Query the target catalog directly to get tables that actually exist there+ target_catalog_sql = f"""+ SELECT DISTINCT table_name+ FROM information_schema.tables+ WHERE table_catalog = '{current_database}'+ AND table_schema = '{schema}'+ """+ result = self._connection.con.execute(+ target_catalog_sql+ ).fetchall()+ target_catalog_tables = {row[0] for row in result}++ # Keep only tables that exist in the target catalog+ filtered = [+ table+ for table in table_names+ if table in target_catalog_tables+ ]+ return filtered++ except Exception as e:+ LOGGER.debug(f"Failed to filter temp tables: {e}")+ # If filtering fails, just dedupe and return+ return list(set(table_names))+def get_table_details(self, *, table_name: str, schema_name: str, database_name: str) -> Optional[DataTable]:diff --git a/tests/_sql/test_get_engines.py b/tests/_sql/test_get_engines.pyindex 45986625dc..8a3a4bceb1 100644--- a/tests/_sql/test_get_engines.py+++ b/tests/_sql/test_get_engines.py@@ -368,7 +368,17 @@ def test_get_engines_ibis_databases() -> None:name="memory",dialect="duckdb",schemas=[Schema(name="main", tables=[])],- )+ ),+ Database(+ name="system",+ dialect="duckdb",+ schemas=[Schema(name="main", tables=[])],+ ),+ Database(+ name="temp",+ dialect="duckdb",+ schemas=[Schema(name="main", tables=[])],+ ),]diff --git a/tests/_sql/test_ibis.py b/tests/_sql/test_ibis.pyindex 20a10cebce..e62bb9b1b2 100644--- a/tests/_sql/test_ibis.py+++ b/tests/_sql/test_ibis.py@@ -17,6 +17,7 @@ from marimo._types.ids import VariableNameHAS_IBIS = DependencyManager.ibis.has()HAS_POLARS = DependencyManager.polars.has()HAS_PANDAS = DependencyManager.pandas.has()+HAS_DUCKDB = DependencyManager.duckdb.has()if TYPE_CHECKING:from ibis.backends.sql import SQLBackend@@ -171,14 +172,18 @@ def test_ibis_empty_engine(empty_ibis_backend: SQLBackend) -> None:databases = engine.get_databases(include_schemas=True, include_tables=True, include_table_details=True)- assert databases == [- Database(- name="memory",- dialect="duckdb",- schemas=[Schema(name="main", tables=[])],- engine=engine_name,- )- ]++ # Find the memory database (ignore system databases)+ memory_databases = [db for db in databases if db.name == "memory"]+ assert len(memory_databases) == 1, "Expected exactly one memory database"+ memory_db = memory_databases[0]++ assert memory_db == Database(+ name="memory",+ dialect="duckdb",+ schemas=[Schema(name="main", tables=[])],+ engine=engine_name,+ )tables = engine.get_tables_in_schema(schema="main", database=UNUSED_DB_NAME, include_table_details=False@@ -510,17 +515,20 @@ def test_ibis_engine_get_databases(ibis_backend: SQLBackend) -> None:include_schemas=True, include_tables=True, include_table_details=True)- assert databases == [- Database(- name="memory",- dialect="duckdb",- schemas=[- get_expected_schema("main", "test"),- get_expected_schema("my_schema", "test2"),- ],- engine=var_name,- )- ]+ # Find the memory database (ignore system databases)+ memory_databases = [db for db in databases if db.name == "memory"]+ assert len(memory_databases) == 1, "Expected exactly one memory database"+ memory_db = memory_databases[0]++ assert memory_db == Database(+ name="memory",+ dialect="duckdb",+ schemas=[+ get_expected_schema("main", "test"),+ get_expected_schema("my_schema", "test2"),+ ],+ engine=var_name,+ )# Test with include_table_details falsedatabases = engine.get_databases(@@ -529,59 +537,74 @@ def test_ibis_engine_get_databases(ibis_backend: SQLBackend) -> None:tables_main = get_expected_table("test", include_table_details=False)tables_my_schema = get_expected_table("test2", include_table_details=False)- assert databases == [- Database(- name="memory",- dialect="duckdb",- schemas=[- Schema(name="main", tables=[tables_main]),- Schema(name="my_schema", tables=[tables_my_schema]),- ],- engine=var_name,- )- ]+ # Find the memory database (ignore system databases)+ memory_databases = [db for db in databases if db.name == "memory"]+ assert len(memory_databases) == 1, "Expected exactly one memory database"+ memory_db = memory_databases[0]++ assert memory_db == Database(+ name="memory",+ dialect="duckdb",+ schemas=[+ Schema(name="main", tables=[tables_main]),+ Schema(name="my_schema", tables=[tables_my_schema]),+ ],+ engine=var_name,+ )# Test with include_tables falsedatabases = engine.get_databases(include_schemas=True, include_tables=False, include_table_details=True)- assert databases == [- Database(- name="memory",- dialect="duckdb",- schemas=[- Schema(name="main", tables=[]),- Schema(name="my_schema", tables=[]),- ],- engine=var_name,- )- ]++ # Find the memory database (ignore system databases)+ memory_databases = [db for db in databases if db.name == "memory"]+ assert len(memory_databases) == 1, "Expected exactly one memory database"+ memory_db = memory_databases[0]++ assert memory_db == Database(+ name="memory",+ dialect="duckdb",+ schemas=[+ Schema(name="main", tables=[]),+ Schema(name="my_schema", tables=[]),+ ],+ engine=var_name,+ )# Test with include_schemas falsedatabases = engine.get_databases(include_schemas=False, include_tables=True, include_table_details=True)- assert databases == [- Database(- name="memory",- dialect="duckdb",- schemas=[],- engine=var_name,- )- ]++ # Find the memory database (ignore system databases)+ memory_databases = [db for db in databases if db.name == "memory"]+ assert len(memory_databases) == 1, "Expected exactly one memory database"+ memory_db = memory_databases[0]++ assert memory_db == Database(+ name="memory",+ dialect="duckdb",+ schemas=[],+ engine=var_name,+ )# Test with include_schemas and include_tables falsedatabases = engine.get_databases(include_schemas=False, include_tables=False, include_table_details=True)- assert databases == [- Database(- name="memory",- dialect="duckdb",- schemas=[],- engine=var_name,- )- ]++ # Find the memory database (ignore system databases)+ memory_databases = [db for db in databases if db.name == "memory"]+ assert len(memory_databases) == 1, "Expected exactly one memory database"+ memory_db = memory_databases[0]++ assert memory_db == Database(+ name="memory",+ dialect="duckdb",+ schemas=[],+ engine=var_name,+ )@pytest.mark.skipif(not HAS_IBIS, reason="Ibis not installed")@@ -602,17 +625,21 @@ def test_ibis_engine_get_databases_auto(ibis_backend: SQLBackend) -> None:tables_my_schema = get_expected_table("test2", include_table_details=True)assert tables_main.columns == tables_my_schema.columnsassert tables_main.primary_keys == tables_my_schema.primary_keys- assert databases == [- Database(- name="memory",- dialect="duckdb",- schemas=[- get_expected_schema("main", "test"),- get_expected_schema("my_schema", "test2"),- ],- engine=var_name,- )- ]++ # Find the memory database (ignore system databases)+ memory_databases = [db for db in databases if db.name == "memory"]+ assert len(memory_databases) == 1, "Expected exactly one memory database"+ memory_db = memory_databases[0]++ assert memory_db == Database(+ name="memory",+ dialect="duckdb",+ schemas=[+ get_expected_schema("main", "test"),+ get_expected_schema("my_schema", "test2"),+ ],+ engine=var_name,+ )# Test with a mock to simulate a non-cheap dialectwith mock.patch.object(@@ -625,14 +652,19 @@ def test_ibis_engine_get_databases_auto(ibis_backend: SQLBackend) -> None:include_table_details="auto",)- assert databases == [- Database(- name="memory",- dialect="duckdb",- schemas=[],- engine=var_name,- )- ]+ # Find the memory database (ignore system databases)+ memory_databases = [db for db in databases if db.name == "memory"]+ assert len(memory_databases) == 1, (+ "Expected exactly one memory database"+ )+ memory_db = memory_databases[0]++ assert memory_db == Database(+ name="memory",+ dialect="duckdb",+ schemas=[],+ engine=var_name,+ )@pytest.mark.skipif(@@ -706,3 +738,214 @@ def test_ibis_engine_sql_output_formats(ibis_backend: SQLBackend) -> None:result = engine.execute("SELECT * FROM test ORDER BY id")assert isinstance(result, (pd.DataFrame, pl.DataFrame))assert len(result) == 3++[email protected](not HAS_IBIS, reason="Ibis not installed")+def test_ibis_get_databases_single_catalog(+ empty_ibis_backend: SQLBackend,+) -> None:+ """Test get_databases with single catalog backend (DuckDB default behavior)."""+ engine = IbisEngine(empty_ibis_backend)++ # Test basic catalog discovery+ databases = engine.get_databases(+ include_schemas=False,+ include_tables=False,+ include_table_details=False,+ )++ # Should discover multiple catalogs+ database_names = {db.name for db in databases}+ assert len(database_names) >= 2+ assert (+ "memory" in database_names or "main" in database_names+ ) # DuckDB default+ assert "temp" in database_names++[email protected](not HAS_IBIS, reason="Ibis not installed")[email protected](not HAS_DUCKDB, reason="DuckDB not installed")+def test_ibis_get_databases_multiple_catalogs(+ empty_ibis_backend: SQLBackend,+) -> None:+ """Test get_databases with multiple catalogs by attaching additional catalog."""+ import ibis++ engine = IbisEngine(empty_ibis_backend)++ # Attach an additional in-memory catalog+ empty_ibis_backend.raw_sql("ATTACH ':memory:' AS test_catalog")++ # Create a test table in the new catalog+ data = ibis.memtable({"id": [1, 2], "value": ["x", "y"]})+ empty_ibis_backend.create_table(+ "test_table", obj=data, database="test_catalog.main"+ )++ # Test catalog discovery+ databases = engine.get_databases(+ include_schemas=False,+ include_tables=False,+ include_table_details=False,+ )++ # Should discover at least 3 catalogs now: memory/main, temp, and test_catalog+ database_names = {db.name for db in databases}+ assert len(database_names) >= 3+ assert "memory" in database_names or "main" in database_names+ assert "temp" in database_names+ assert "test_catalog" in database_names++ # Verify the test table exists in test_catalog using list_tables+ tables_in_test_catalog = engine.get_tables_in_schema(+ schema="main", database="test_catalog", include_table_details=False+ )+ table_names = {table.name for table in tables_in_test_catalog}+ assert "test_table" in table_names++[email protected](not HAS_IBIS, reason="Ibis not installed")[email protected](not HAS_DUCKDB, reason="DuckDB not installed")+def test_duckdb_temp_table_only_in_temp_catalog(+ empty_ibis_backend: SQLBackend,+) -> None:+ """E2E: Test that temp tables created with temp=True only show up in temp catalog."""+ import ibis++ engine = IbisEngine(empty_ibis_backend)++ # Create a temp table and a regular table+ data = ibis.memtable({"id": [1, 2, 3], "value": ["a", "b", "c"]})+ empty_ibis_backend.create_table("temp_only_table", obj=data, temp=True)+ empty_ibis_backend.create_table("regular_table", obj=data, temp=False)++ # Check main/memory catalog - should NOT have the temp table+ main_tables = engine.get_tables_in_schema(+ schema="main", database="memory", include_table_details=False+ )+ main_table_names = {table.name for table in main_tables}+ assert "temp_only_table" not in main_table_names+ assert "regular_table" in main_table_names++ # Check temp catalog - should have the temp table+ temp_tables = engine.get_tables_in_schema(+ schema="main", database="temp", include_table_details=False+ )+ temp_table_names = {table.name for table in temp_tables}+ assert "temp_only_table" in temp_table_names+ assert "regular_table" not in temp_table_names++[email protected](not HAS_IBIS, reason="Ibis not installed")[email protected](not HAS_DUCKDB, reason="DuckDB not installed")+def test_duckdb_deduplication_same_table_both_catalogs(+ empty_ibis_backend: SQLBackend,+) -> None:+ """Test deduplication logic when same table name exists in both main and temp catalogs."""+ import ibis++ engine = IbisEngine(empty_ibis_backend)++ # Create a table with same name in both main and temp catalogs+ shared_data = ibis.memtable({"id": [1, 2], "name": ["main", "data"]})+ temp_data = ibis.memtable({"id": [3, 4], "name": ["temp", "data"]})+ temp_only_data = ibis.memtable({"id": [5, 6], "value": ["temp", "only"]})++ # Create table in main catalog+ empty_ibis_backend.create_table(+ "shared_table", obj=shared_data, temp=False+ )++ # Create table with same name in temp catalog+ empty_ibis_backend.create_table("shared_table", obj=temp_data, temp=True)++ # Create temp-only table+ empty_ibis_backend.create_table(+ "temp_only_table", obj=temp_only_data, temp=True+ )++ # List tables in main catalog - should get deduplicated shared_table but NOT temp_only_table+ main_tables = engine.get_tables_in_schema(+ schema="main", database="memory", include_table_details=False+ )+ main_table_names = {table.name for table in main_tables}++ # Should have shared_table (deduplicated) but not temp_only_table+ assert "shared_table" in main_table_names+ assert "temp_only_table" not in main_table_names++ # Verify shared_table appears only once in the list+ shared_tables = [+ table for table in main_tables if table.name == "shared_table"+ ]+ assert len(shared_tables) == 1++ # List tables in temp catalog - should have both temp tables+ temp_tables = engine.get_tables_in_schema(+ schema="main", database="temp", include_table_details=False+ )+ temp_table_names = {table.name for table in temp_tables}++ # Temp catalog should have both tables+ assert "shared_table" in temp_table_names+ assert "temp_only_table" in temp_table_names++[email protected](not HAS_IBIS, reason="Ibis not installed")+def test_ibis_sqlite_catalog_discovery() -> None:+ """Test catalog discovery for SQLite backend (non-DuckDB)."""+ try:+ import os+ import tempfile++ import ibis++ # Create temporary SQLite database+ with tempfile.NamedTemporaryFile(suffix=".db", delete=False) as f:+ db_path = f.name++ try:+ sqlite_backend = ibis.sqlite.connect(db_path)++ # Create a simple table for testing+ test_data = ibis.memtable(+ {"id": [1, 2], "name": ["test1", "test2"]}+ )+ sqlite_backend.create_table(+ "test_table", test_data, overwrite=True+ )++ engine = IbisEngine(+ sqlite_backend, engine_name=VariableName("sqlite_test")+ )++ # Test catalog discovery - should use original Ibis logic, not DuckDB filtering+ databases = engine.get_databases(+ include_schemas=True,+ include_tables=True,+ include_table_details=False,+ )++ database_names = {db.name for db in databases}+ print(f"SQLite databases found: {database_names}")++ # SQLite typically has one main database+ assert len(database_names) >= 1++ # Verify that we can find tables+ if databases:+ total_tables = 0+ for db in databases:+ for schema in db.schemas:+ total_tables += len(schema.tables)+ assert total_tables >= 1, (+ "Should find at least the test_table we created"+ )++ finally:+ os.unlink(db_path)++ except ImportError:+ pytest.skip("SQLite not available")+ except Exception as e:+ pytest.skip(f"SQLite test failed: {e}")