| 12 | |
| 13 | |
| 14 | def 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) |