add repr to db rows
This commit is contained in:
parent
e0001625ae
commit
3de920f54b
1 changed files with 6 additions and 1 deletions
|
@ -96,6 +96,11 @@ aiosqlite.Connection.fetch_exists = fetch_exists
|
||||||
aiosqlite.Connection.fetch_unpacked = fetch_unpacked
|
aiosqlite.Connection.fetch_unpacked = fetch_unpacked
|
||||||
|
|
||||||
|
|
||||||
|
class Row(sqlite3.Row):
|
||||||
|
def __repr__(self):
|
||||||
|
return f"Row<{repr(dict(self))}>"
|
||||||
|
|
||||||
|
|
||||||
async def setup_db(db_file):
|
async def setup_db(db_file):
|
||||||
log.debug(f"Connecting to {db_file}")
|
log.debug(f"Connecting to {db_file}")
|
||||||
db = await aiosqlite.connect(db_file)
|
db = await aiosqlite.connect(db_file)
|
||||||
|
@ -108,7 +113,7 @@ async def setup_db(db_file):
|
||||||
""")
|
""")
|
||||||
|
|
||||||
log.debug("Setting row factory")
|
log.debug("Setting row factory")
|
||||||
db.row_factory = sqlite3.Row
|
db.row_factory = Row
|
||||||
|
|
||||||
log.debug("Adding contains function")
|
log.debug("Adding contains function")
|
||||||
await db.create_function("contains", 3, contains, deterministic=True)
|
await db.create_function("contains", 3, contains, deterministic=True)
|
||||||
|
|
Loading…
Reference in a new issue