OpenTAXII
OpenTAXII copied to clipboard
Update taxii2models.py
Here, I need to specify a forced sorting based on the "date_added" field; otherwise, when retrieving data using as_pages(_COLLECTION.get_objects, per_request=limit, added_after=timestamp_filter), I won't be able to obtain all the data.
def _objects_query(self, collection_id: str, ordered: bool) -> Query:
query = self.db.session.query(taxii2models.STIXObject).filter(
taxii2models.STIXObject.collection_id == collection_id,
)
if ordered:
query = query.order_by(
taxii2models.STIXObject.date_added, taxii2models.STIXObject.id
)
return query
The previous function is already doing the ordering and it is called by Taxii2SQLDatabaseAPI.get_objects.
Could you elaborate on your use-case and why it is not ordered ?