fix(integration): asyncio auto-mode, per-test truncation, artist images IN-subquery

This commit is contained in:
2026-05-15 22:23:32 -04:00
parent 65a055408b
commit 13be9085b5
3 changed files with 41 additions and 6 deletions
+10 -6
View File
@@ -157,12 +157,16 @@ class ArtistService:
if artist is None:
return None
stmt = (
select(ImageRecord)
.join(ImageProvenance, ImageProvenance.image_record_id == ImageRecord.id)
.join(Source, Source.id == ImageProvenance.source_id)
.where(Source.artist_id == artist.id)
.distinct()
# Dedupe via IN-subquery rather than JOIN + DISTINCT: an image can
# have several provenance rows for one artist, and SELECT DISTINCT
# over ImageRecord fails in Postgres because its json columns have
# no equality operator.
stmt = select(ImageRecord).where(
ImageRecord.id.in_(
select(ImageProvenance.image_record_id)
.join(Source, Source.id == ImageProvenance.source_id)
.where(Source.artist_id == artist.id)
)
)
if cursor:
cur_ts, cur_id = decode_cursor(cursor)