Add isinstance check for sqlite3.Row.

This commit is contained in:
voussoir 2022-03-19 20:03:50 -07:00
parent 465f22fedb
commit 4b0d50c193
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -5,6 +5,7 @@ import abc
import functools import functools
import random import random
import re import re
import sqlite3
import typing import typing
from voussoirkit import sqlhelpers from voussoirkit import sqlhelpers
@ -433,7 +434,7 @@ class DatabaseWithCaching(Database, metaclass=abc.ABCMeta):
object_table = object_class.table object_table = object_class.table
object_cache = self.caches.get(object_class, None) object_cache = self.caches.get(object_class, None)
if isinstance(db_row, dict): if isinstance(db_row, (dict, sqlite3.Row)):
object_id = db_row['id'] object_id = db_row['id']
else: else:
object_index = self.COLUMN_INDEX[object_table] object_index = self.COLUMN_INDEX[object_table]