Skip to content
Snippets Groups Projects

Use `.iterator()` from peewee when querying

Merged Eva Bardou requested to merge use-iterators into main
@@ -17,11 +17,13 @@ def retrieve_element(element_id: UUID) -> Element:
def list_classifications(element_id: UUID):
return Classification.select().where(Classification.element == element_id)
return (
Classification.select().where(Classification.element == element_id).iterator()
)
def list_transcriptions(element_id: UUID):
return Transcription.select().where(Transcription.element == element_id)
return Transcription.select().where(Transcription.element == element_id).iterator()
def list_transcription_entities(transcription_id: UUID):
@@ -30,4 +32,5 @@ def list_transcription_entities(transcription_id: UUID):
.where(TranscriptionEntity.transcription == transcription_id)
.join(Entity, on=TranscriptionEntity.entity)
.join(EntityType, on=Entity.type)
.iterator()
)
Loading