QueryResult(session, expression, page_size=500)¶
Results from a query.
OFFSET_EXPRESSION= re.compile('(?P<offset>offset (?P<value>\\d+))')¶
LIMIT_EXPRESSION= re.compile('(?P<limit>limit (?P<value>\\d+))')¶
__init__(session, expression, page_size=500)¶
Initialise result set.
session should be an instance of
ftrack_api.session.Sessionthat will be used for executing the query expression.
page_size should be an integer specifying the maximum number of records to fetch in one request allowing the results to be fetched incrementally in a transparent manner for optimal performance. Any offset or limit specified in expression are honoured for final result set, but intermediate queries may be issued with different offsets and limits in order to fetch pages. When an embedded limit is smaller than the given page_size it will be used instead and no paging will take place.
Setting page_size to a very large amount may negatively impact performance of not only the caller, but the server in general.
Fetch and return all data.
count(value) → integer -- return number of occurrences of value¶
index(value[, start[, stop]]) → integer -- return first index of value.¶
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
Return exactly one single result from query by applying a limit.
ValueErrorif an existing limit is already present in the expression.
ValueErrorif an existing offset is already present in the expression as offset is inappropriate when expecting a single item.
Both errors subclass
IncorrectResultErrorif you want to catch only one error type.