aiosqlite
aiosqlite copied to clipboard
Support subclassing Connection
trafficstars
Description
Add cls kwarg to core.connect that is a subclass or Connection (or a Callable[[Callable[[Any], sqlite3.Connection], int], Connection]) (default: Connection)
Example usage:
class MyConnection(aiosqlite.Connection):
...
async def main():
conn = await aiosqlite.connect(':memory:', cls=MyConnection)
# use methods and attrs of MyConnection
Current workaround: connect must be redefined to explicitly call your custom async connection factory.
Sounds good. Can you add a simple test case covering this?