DataLab queries
DataLabBuilder builds the same queries the API reference documents, without hand-writing the request body. Every criterion returns the builder, so they chain, and nothing is requested until you read the selection.
Criteria combine with AND by default. Pass logic="OR" to any of them to change that, and use the grouping helpers below when precedence matters.
Basic query / Entity Type criteria
Most queries start with an Entity Type. Pass include_children to take its sub-types too.
Criteria: Attributes
Attributes address by slash separated path. The named helpers cover the common operators, and where takes any operator the API accepts.
Criteria: Tags
Criteria: User
Criteria: LOD
Criteria: Assembly
Criteria: Relations and attachments
Criteria: Geometry
The spatial criteria take a Bruce geometry, which GeometryBuilder constructs. A generated texture also answers with geometries, so an area of a simulation goes straight in here.
Criteria: Reference to another DataLab query
Criteria: '()' groups
A group is a branch built from the same builder. group_any joins the branches with OR, group_all with AND, and the group as a whole joins the rest of the query by its own logic.
Reading the selection
Nothing is requested while the query is being built. These are the calls that go to the API, and each pages underneath so a large selection is never held in full.
Things worth knowing
The builder is immutable. Every criterion returns a new builder rather than changing the one you called it on, so a base query can be branched into several without them affecting each other.
Order before you page. Paging an unordered selection can repeat or skip records if the underlying data changes while you walk it. snapshot_ids takes the whole ID list up front when that matters more than memory.
Ask for a count before a walk. count transfers nothing, so it is the cheap way to decide whether a selection is worth reading at all.