MCPcopy Index your code
hub / github.com/marimo-team/marimo / duckdb_connection

Function duckdb_connection

tests/_sql/test_sql.py:75–100  ·  view source on GitHub ↗

Create a DuckDB connection for testing.

()

Source from the content-addressed store, hash-verified

73
74@pytest.fixture
75def duckdb_connection() -> Generator[duckdb.DuckDBPyConnection, None, None]:
76 """Create a DuckDB connection for testing."""
77 import duckdb
78
79 conn = duckdb.connect(":memory:")
80 sql(
81 """
82 CREATE TABLE test (
83 id INTEGER PRIMARY KEY,
84 name TEXT
85 );
86 """,
87 engine=conn,
88 )
89 sql(
90 """
91 INSERT INTO test VALUES
92 (1, 'Alice'),
93 (2, 'Bob'),
94 (3, 'Charlie');
95 """,
96 engine=conn,
97 )
98
99 yield conn
100 conn.close()
101
102
103@pytest.mark.skipif(not HAS_SQLALCHEMY, reason="SQLAlchemy not installed")

Callers

nothing calls this directly

Calls 3

sqlFunction · 0.90
closeMethod · 0.65
connectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…