Skip to content
Snippets Groups Projects
Commit b2e50a0d authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files
parent 7a85fa10
Branches
Tags
No related merge requests found
......@@ -34,7 +34,7 @@ from collections.abc import Iterable
from subprocess import call
from . import (BOOLEAN, DATETIME, DOUBLE, FILE, INTEGER, REFERENCE, TEXT,
TIMESPAN, get_config)
TIMESPAN, execute_query, get_config)
from .common.models import (Container, Entity, File, Property, Query, Record,
RecordType)
......@@ -657,3 +657,26 @@ def describe_diff(olddiff, newdiff, name=None, as_update=True):
"version of {}\n\n".format(name))+description
return description
def id_query(ids):
""" executes a query that returns entities purely based on whether their id
is in the supplied list of ids """
q = "FIND Entity with " + " OR ".join(["id={}".format(id) for id in ids])
return execute_query(q)
def retrieve_multiple_entities(ids, step=20):
"""
retrieve the entities with the ids in the supplied list.
Entities are retrieved via queries. Due to a limited length of the query,
the entities are retrieved in chunks of sive "step")
"""
collection = Container()
for i in range(len(ids)//step+1):
collection.extend(id_query(ids[i*step:(i+1)*step]))
return collection
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment