fix(integration): asyncio auto-mode, per-test truncation, artist images IN-subquery
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user