같은 API, await 만 뿌림
aiosqlite 가 standard sqlite3 모듈 wrap, 모든 연산 await 가능. 내부에서 connection 마다 single 백그라운드 thread 에 호출 push — event loop 절대 block 안 됨.
pip install aiosqlite중요한 모양:
aiosqlite.connect(path)— connection yield 하는 async context manager.conn.execute(sql, params)— async cursor 반환.await cursor.fetchone(),await cursor.fetchall().async for row in conn.execute(...)— streaming iteration.conn.row_factory = aiosqlite.Row— sync sqlite3 와 같은 dict-like row.
Tip: Sync sqlite3 에 설정한 같은 PRAGMA — WAL, foreign_keys, busy_timeout — 설정. aiosqlite 가 underlying connection 에 그대로 forward.