From c63f63f6a7436f1780eab89d7575e6e32139ae69 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Tue, 15 Mar 2022 18:19:21 -0700 Subject: [PATCH] Use sql.row_factory = sqlite3.Row. --- etiquette/objects.py | 5 ----- etiquette/photodb.py | 2 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/etiquette/objects.py b/etiquette/objects.py index 703c3d4..7de448c 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -262,7 +262,6 @@ class Album(ObjectBase, GroupableMixin): def __init__(self, photodb, db_row): super().__init__(photodb) - db_row = self.photodb.normalize_db_row(db_row, self.table) self.id = db_row['id'] self.title = self.normalize_title(db_row['title']) @@ -699,7 +698,6 @@ class Bookmark(ObjectBase): def __init__(self, photodb, db_row): super().__init__(photodb) - db_row = self.photodb.normalize_db_row(db_row, self.table) self.id = db_row['id'] self.title = self.normalize_title(db_row['title']) @@ -809,7 +807,6 @@ class Photo(ObjectBase): def __init__(self, photodb, db_row): super().__init__(photodb) - db_row = self.photodb.normalize_db_row(db_row, self.table) self.real_path = db_row['filepath'] self.real_path = pathclass.Path(self.real_path) @@ -1447,7 +1444,6 @@ class Tag(ObjectBase, GroupableMixin): def __init__(self, photodb, db_row): super().__init__(photodb) - db_row = self.photodb.normalize_db_row(db_row, self.table) self.id = db_row['id'] # Do not pass the name through the normalizer. It may be grandfathered @@ -1823,7 +1819,6 @@ class User(ObjectBase): def __init__(self, photodb, db_row): super().__init__(photodb) - db_row = self.photodb.normalize_db_row(db_row, self.table) self.id = db_row['id'] self.username = db_row['username'] diff --git a/etiquette/photodb.py b/etiquette/photodb.py index ae5f3c6..a6240fe 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -1601,6 +1601,7 @@ class PhotoDB( if self.ephemeral: existing_database = False self.sql = sqlite3.connect(':memory:') + self.sql.row_factory = sqlite3.Row self._first_time_setup() return @@ -1614,6 +1615,7 @@ class PhotoDB( self.data_directory.makedirs(exist_ok=True) log.debug('Connecting to sqlite file "%s".', self.database_filepath.absolute_path) self.sql = sqlite3.connect(self.database_filepath.absolute_path) + self.sql.row_factory = sqlite3.Row if existing_database: if not skip_version_check: