MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / regular

Function regular

test/typing/plain_files/engine/engines.py:14–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13
14def regular() -> None:
15 e = create_engine("sqlite://")
16
17 assert_type(e, Engine)
18
19 with e.connect() as conn:
20 assert_type(conn, Connection)
21
22 result = conn.execute(text("select * from table"))
23
24 assert_type(result, CursorResult[Unpack[tuple[Any, ...]]])
25
26 with e.begin() as conn:
27 assert_type(conn, Connection)
28
29 result = conn.execute(text("select * from table"))
30
31 assert_type(result, CursorResult[Unpack[tuple[Any, ...]]])
32
33 engine = create_engine("postgresql://scott:tiger@localhost/test")
34 status: str = engine.pool.status()
35 other_pool: Pool = engine.pool.recreate()
36 ce = select(1).compile(e)
37 ce.statement
38 cc = select(1).compile(conn)
39 cc.statement
40
41 print(status, other_pool)

Callers

nothing calls this directly

Calls 9

create_engineFunction · 0.90
textFunction · 0.90
selectFunction · 0.90
connectMethod · 0.45
executeMethod · 0.45
beginMethod · 0.45
statusMethod · 0.45
recreateMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected