From 980dd0ac603fbcf467b87480955fe2dd73421e92 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Thu, 10 Oct 2024 20:42:47 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AD=E3=82=B0=E5=87=BA=E5=8A=9B=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update_db.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/update_db.py b/update_db.py index 43cd496..0a6ceae 100644 --- a/update_db.py +++ b/update_db.py @@ -324,6 +324,7 @@ class VideoDao: id = %s ORDER BY id""", (video_id,)) + print (c._executed) row = cast (VideoRow | None, c.fetchone ()) if row is None: return None @@ -346,6 +347,7 @@ class VideoDao: videos ORDER BY id""") + print (c._executed) videos: list[VideoDto] = [] for row in cast (list[VideoRow], c.fetchall ()): videos.append (self._create_dto_from_row (row, with_relation_tables)) @@ -367,6 +369,7 @@ class VideoDao: videos WHERE deleted_at IS NULL""") + print (c._executed) videos: list[VideoDto] = [] for row in cast (list[VideoRow], c.fetchall ()): videos.append (self._create_dto_from_row (row, False)) @@ -411,6 +414,7 @@ class VideoDao: video.description, video.uploaded_at, deleted_at)) + print (c._executed) video.id_ = c.lastrowid if with_relation_tables: if video.video_tags is not None: @@ -443,6 +447,7 @@ class VideoDao: deleted_at = %%s WHERE id IN (%s)""" % ', '.join (['%s'] * len (video_ids)), (at, *video_ids)) + print (c._executed) def _create_dto_from_row ( self, @@ -507,6 +512,7 @@ class VideoTagDao: video_id = %s ORDER BY id""", (video_id,)) + print (c._executed) video_tags: list[VideoTagDto] = [] for row in cast (list[VideoTagRow], c.fetchall ()): video_tags.append (self._create_dto_from_row (row, with_relation_tables)) @@ -532,6 +538,7 @@ class VideoTagDao: AND (untagged_at IS NULL) ORDER BY id""", (video_id,)) + print (c._executed) video_tags: list[VideoTagDto] = [] for row in cast (list[VideoTagRow], c.fetchall ()): video_tags.append (self._create_dto_from_row (row, with_relation_tables)) @@ -556,6 +563,7 @@ class VideoTagDao: WHERE video_id = %s AND tag_id = %s""", (video_id, tag_id)) + print (c._executed) row = cast (VideoTagRow, c.fetchone ()) if row is None: return None @@ -588,6 +596,7 @@ class VideoTagDao: %s, %s)""", (video_tag.video_id, video_tag.tag_id, video_tag.tagged_at, untagged_at)) + print (c._executed) video_tag.id_ = c.lastrowid if with_relation_tables: if video_tag.video is not None: @@ -630,6 +639,7 @@ class VideoTagDao: video_tag.tag_id, video_tag.tagged_at, untagged_at)) + print (c._executed) video_tag.id_ = c.lastrowid if with_relation_tables: if video_tag.video is not None: @@ -662,6 +672,7 @@ class VideoTagDao: WHERE video_id = %%s AND tag_id IN (%s)""" % ', '.join (['%s'] * len (tag_ids)), (now, video_id, *tag_ids)) + print (c._executed) def _create_dto_from_row ( self, @@ -710,6 +721,7 @@ class TagDao: tags WHERE id = %s""", (tag_id,)) + print (c._executed) row = cast (TagRow | None, c.fetchone ()) if row is None: return None @@ -728,6 +740,7 @@ class TagDao: tags WHERE name = %s""", (tag_name,)) + print (c._executed) row = cast (TagRow | None, c.fetchone ()) if row is None: return None @@ -743,6 +756,7 @@ class TagDao: tags(name) VALUES (%s)""", (tag.name,)) + print (c._executed) tag.id_ = c.lastrowid def upsert ( @@ -758,6 +772,7 @@ class TagDao: ON DUPLICATE KEY UPDATE id = LAST_INSERT_ID(id), name = VALUES(name)""", (tag.name,)) + print (c._executed) tag.id_ = c.lastrowid def _create_dto_from_row ( @@ -797,6 +812,7 @@ class VideoHistoryDao: video_histories WHERE video_id = %s""", (video_id,)) + print (c._executed) video_histories: list[VideoHistoryDto] = [] for row in cast (list[VideoHistoryRow], c.fetchall ()): video_histories.append (self._create_dto_from_row (row, with_relation_tables)) @@ -820,6 +836,7 @@ class VideoHistoryDao: %s)""", (video_history.video_id, video_history.fetched_at, video_history.views_count)) + print (c._executed) def upsert ( self, @@ -844,6 +861,7 @@ class VideoHistoryDao: views_count = VALUES(views_count)""", (video_history.video_id, video_history.fetched_at, video_history.views_count)) + print (c._executed) def upsert_all ( self, @@ -902,6 +920,7 @@ class CommentDao: comments WHERE video_id = %s""", (video_id,)) + print (c._executed) comments: list[CommentDto] = [] for row in cast (list[CommentRow], c.fetchall ()): comments.append (self._create_dto_from_row (row, with_relation_tables)) @@ -954,6 +973,7 @@ class CommentDao: comment.posted_at, comment.nico_count, vpos_ms)) + print (c._executed) def upsert_all ( self, @@ -1015,6 +1035,7 @@ class UserDao: users WHERE code = %s""", (user_code,)) + print (c._executed) row = cast (UserRow | None, c.fetchone ()) if row is None: return None @@ -1030,6 +1051,7 @@ class UserDao: users(code) VALUES (%s)""", (user.code,)) + print (c.execute) user.id_ = c.lastrowid def _create_dto_from_row (