models Package
Data models and type definitions for the Dataverse SDK.
Provides dataclasses and helpers for Dataverse entities:
- QueryBuilder: Fluent query builder.
- filters: Composable OData filter expressions via col and raw.
- QueryResult: Iterable result wrapper.
- Record: Dataverse entity record.
- UpsertItem: Upsert operation item.
- FetchXmlQuery: FetchXML query object.
- DataverseModel: Typed-model protocol.
Modules
| batch |
Public result types for batch operations. |
| fetchxml_query |
FetchXmlQuery — inert query object returned by QueryOperations.fetchxml(). |
| filters |
Composable OData filter expressions for the Dataverse SDK. Provides an expression tree that compiles to OData Example::
|
| labels |
Label models for Dataverse metadata. |
| protocol |
DataverseModel structural Protocol for typed entity integration. |
| query_builder |
Fluent query builder for constructing OData queries. Provides a type-safe, discoverable interface for building complex queries against Dataverse tables with method chaining. Example::
|
| record |
Record models for Dataverse data. |
| relationship |
Relationship models for Dataverse (input and output). |
| table_info |
Table and column metadata models for Dataverse. |
| upsert |
Upsert data models for the Dataverse SDK. |
Classes
| AlternateKeyInfo |
Alternate key metadata for a Dataverse table. |
| BatchItemResponse |
Response from a single operation within a batch request. Responses are returned in submission order. For operations added to a changeset, responses appear in the changeset's position in that order. Example:
|
| BatchResult |
Result of executing a batch request. Contains one BatchItemResponse per HTTP operation submitted.
Operations that expand to multiple HTTP requests (e.g. Example:
|
| CascadeConfiguration |
Defines cascade behavior for relationship operations. Valid values for each parameter:
|
| ColumnInfo |
Column metadata from a Dataverse table definition. |
| ColumnProxy |
Fluent proxy for building OData filter expressions from a column name. Returned by col. Operator overloads and methods produce
FilterExpression instances that can be passed to
Example:
|
| DataverseModel |
Structural Protocol enabling typed entity instances to be passed to
Implement this Protocol on any entity class (dataclass, Pydantic model, hand-rolled) to enable it to be passed directly to CRUD operations without specifying the table name or converting to dict manually. Required class variables:
Required instance methods:
Example:
Note Direct dispatch (client.records.create(entity) without a table name or dict) is not yet supported and will be added in a future release. |
| ExpandOption |
Structured options for an Allows specifying nested Example:
|
| FetchXmlQuery |
Inert FetchXML query object. No HTTP request is made until execute or execute_pages is called. Obtained via |
| FilterExpression |
Base class for composable OData filter expressions. Supports Python operator overloads for logical composition:
|
| Label |
Represents a label that can have multiple localized versions. |
| LocalizedLabel |
Represents a localized label with a language code. |
| LookupAttributeMetadata |
Metadata for a lookup attribute. Valid required_level values:
|
| ManyToManyRelationshipMetadata |
Metadata for a many-to-many entity relationship. |
| OneToManyRelationshipMetadata |
Metadata for a one-to-many entity relationship. |
| QueryBuilder |
Fluent interface for building and executing OData queries against a sync client. Provides method chaining for constructing complex queries with
composable filter expressions. Can be used standalone (via |
| QueryParams |
Typed dictionary returned by Provides IDE autocomplete when passing build results to
|
| QueryResult |
Iterable wrapper around a list of Record objects. Returned by execute (flat mode) and list. Backward-compatible: |
| RelationshipInfo |
Typed return model for relationship metadata. Returned by create_one_to_many_relationship, create_many_to_many_relationship, get_relationship, and create_lookup_field. Example:
|
| TableInfo |
Table metadata with dict-like backward compatibility. Supports both new attribute access ( Example:
|
| UpsertItem |
Represents a single upsert operation targeting a record by its alternate key. Used with upsert to upsert one or more records identified by alternate keys rather than primary GUIDs. Example:
|
Functions
col
Return a ColumnProxy for building filter expressions.
This is the preferred GA idiom for constructing filter expressions:
from PowerPlatform.Dataverse.models.filters import col
expr = col("statecode") == 0
expr = col("revenue") > 1_000_000
expr = col("name").like("Contoso%")
expr = col("statecode").in_([0, 1])
expr = col("parentaccountid").is_null()
col(name: str) -> ColumnProxy
Parameters
| Name | Description |
|---|---|
|
name
Required
|
Column logical name (case-insensitive, will be lowercased). |
Returns
| Type | Description |
|---|---|
|
A ColumnProxy bound to the column. |
Exceptions
| Type | Description |
|---|---|
|
If |
raw
Verbatim OData filter expression (passed through unchanged).
This function is not deprecated — it is the OData escape hatch with no typed replacement.
Example:
raw("Microsoft.Dynamics.CRM.Today(PropertyName='createdon')")
raw(filter_string: str) -> FilterExpression
Parameters
| Name | Description |
|---|---|
|
filter_string
Required
|
Raw OData filter string. |
Returns
| Type | Description |
|---|---|