ftrack_api.query

class ftrack_api.query.QueryResult(session, expression, page_size=500)[source]

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)[source]

Initialise result set.

session should be an instance of ftrack_api.session.Session that 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.

Warning

Setting page_size to a very large amount may negatively impact performance of not only the caller, but the server in general.

all()[source]

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.

one()[source]

Return exactly one single result from query by applying a limit.

Raise ValueError if an existing limit is already present in the expression.

Raise ValueError if an existing offset is already present in the expression as offset is inappropriate when expecting a single item.

Raise MultipleResultsFoundError if more than one result was available or NoResultFoundError if no results were available.

Note

Both errors subclass IncorrectResultError if you want to catch only one error type.

first()[source]

Return first matching result from query by applying a limit.

Raise ValueError if an existing limit is already present in the expression.

If no matching result available return None.