diff sat/memory/sqla.py @ 3753:10b71e3526bd

core (memory/sqla): add attribute to filter on `item_ids` in `getItems`
author Goffi <goffi@goffi.org>
date Fri, 13 May 2022 17:58:51 +0200
parents 658ddbabaf36
children af485e8afe03
line wrap: on
line diff
--- a/sat/memory/sqla.py	Fri May 13 17:57:24 2022 +0200
+++ b/sat/memory/sqla.py	Fri May 13 17:58:51 2022 +0200
@@ -1224,6 +1224,7 @@
         self,
         node: PubsubNode,
         max_items: Optional[int] = None,
+        item_ids: Optional[list[str]] = None,
         before: Optional[str] = None,
         after: Optional[str] = None,
         from_index: Optional[int] = None,
@@ -1279,6 +1280,9 @@
             .limit(max_items)
         )
 
+        if item_ids is not None:
+            stmt = stmt.where(PubsubItem.name.in_(item_ids))
+
         if not order_by:
             order_by = [C.ORDER_BY_MODIFICATION]