operations Package

Operation namespaces for the Dataverse SDK.

This module contains the operation namespace classes that organize SDK operations into logical groups: records, query, and tables.

Modules

batch

Batch operation namespaces for the Dataverse SDK.

dataframe

DataFrame CRUD operations namespace for the Dataverse SDK.

files

File operations namespace for the Dataverse SDK.

query

Query operations namespace for the Dataverse SDK.

records

Record CRUD operations namespace for the Dataverse SDK.

tables

Table metadata operations namespace for the Dataverse SDK.

Classes

BatchDataFrameOperations

DataFrame-oriented wrappers for batch record operations.

Provides create, update, and delete that accept pandas.DataFrame / pandas.Series inputs and convert them to standard dicts before enqueueing on the batch. This lets data-science callers feed DataFrames directly into a batch without manual conversion.

Accessed via batch.dataframe.

Example:


   import pandas as pd

   batch = client.batch.new()
   df = pd.DataFrame([
       {"name": "Contoso", "telephone1": "555-0100"},
       {"name": "Fabrikam", "telephone1": "555-0200"},
   ])
   batch.dataframe.create("account", df)
   result = batch.execute()
BatchOperations

Namespace for batch operations (client.batch).

Accessed via client.batch. Use new to create a BatchRequest builder.

Example:


   batch = client.batch.new()
   batch.records.create("account", {"name": "Fabrikam"})
   result = batch.execute()
BatchQueryOperations

Query operations on a BatchRequest.

Mirrors client.query exactly: same method names, same signatures. All methods return None; results arrive via BatchResult.

Do not instantiate directly; use batch.query.

BatchRecordOperations

Record operations on a BatchRequest.

Mirrors client.records: same method names, same signatures. All methods return None; results are available via BatchResult after execute.

GA methods: retrieve (single record) and list (multi-record, single page). get is deprecated — use retrieve instead.

Do not instantiate directly; use batch.records.

BatchRequest

Builder for constructing and executing a Dataverse OData $batch request.

Obtain via new (client.batch.new()). Add operations through records, tables, query, and dataframe, optionally group writes into a changeset, then call execute.

Operations are executed sequentially in the order added. The resulting BatchResult contains one BatchItemResponse per HTTP request dispatched (some operations expand to multiple requests).

Note

Maximum 1000 HTTP operations per batch.

Example:


   batch = client.batch.new()
   batch.records.create("account", {"name": "Contoso"})
   batch.tables.get("account")
   with batch.changeset() as cs:
       ref = cs.records.create("contact", {"firstname": "Alice"})
       cs.records.update("account", account_id, {
           "primarycontactid@odata.bind": ref
       })
   result = batch.execute()
BatchTableOperations

Table metadata operations on a BatchRequest.

Mirrors client.tables exactly: same method names, same signatures. All methods return None; results arrive via BatchResult.

Note

tables.delete, tables.add_columns, and tables.remove_columns

require a metadata lookup (GET EntityDefinitions) at

execute time to resolve the table's MetadataId.

This lookup is transparent to the caller.

Note

tables.add_columns and tables.remove_columns each produce one

batch item per column, so they contribute multiple entries to

responses.

Do not instantiate directly; use batch.tables.

ChangeSet

A transactional group of single-record write operations.

All operations succeed or are rolled back together. Use as a context manager or call records to add operations directly.

Do not instantiate directly; use changeset.

Example:


   with batch.changeset() as cs:
       ref = cs.records.create("contact", {"firstname": "Alice"})
       cs.records.update("account", account_id, {
           "primarycontactid@odata.bind": ref
       })
ChangeSetRecordOperations

Record write operations available inside a ChangeSet.

Mirrors client.records but restricted to single-record forms (no bulk create/update/delete). Only write operations are allowed — GET is not permitted inside a changeset.

Do not instantiate directly; use ChangeSet.records.

DataFrameOperations

Namespace for pandas DataFrame CRUD operations.

Accessed via client.dataframe. Provides DataFrame-oriented wrappers around the record-level CRUD operations.

Example:


   import pandas as pd

   client = DataverseClient(base_url, credential)

   # Query records as a DataFrame
   df = client.dataframe.get("account", select=["name"], top=100)

   # Create records from a DataFrame
   new_df = pd.DataFrame([{"name": "Contoso"}, {"name": "Fabrikam"}])
   new_df["accountid"] = client.dataframe.create("account", new_df)

   # Update records
   new_df["telephone1"] = ["555-0100", "555-0200"]
   client.dataframe.update("account", new_df, id_column="accountid")

   # Delete records
   client.dataframe.delete("account", new_df["accountid"])
FileOperations

Namespace for file operations.

Accessed via client.files. Provides file upload operations for Dataverse file columns.

Example:


   client = DataverseClient(base_url, credential)

   client.files.upload(
       "account", account_id, "new_Document", "/path/to/file.pdf"
   )
QueryOperations

Namespace for query operations.

Accessed via client.query. Provides query and search operations against Dataverse tables.

Example:


   from PowerPlatform.Dataverse.models.filters import col

   client = DataverseClient(base_url, credential)

   # Fluent query builder (recommended)
   for record in (client.query.builder("account")
                  .select("name", "revenue")
                  .where(col("statecode") == 0)
                  .order_by("revenue", descending=True)
                  .top(100)
                  .execute()):
       print(record["name"])

   # SQL query
   rows = client.query.sql("SELECT TOP 10 name FROM account ORDER BY name")
   for row in rows:
       print(row["name"])
RecordOperations

Namespace for record-level CRUD operations.

Accessed via client.records. Provides create, update, delete, and get operations on individual Dataverse records.

Example:


   client = DataverseClient(base_url, credential)

   # Create a single record
   guid = client.records.create("account", {"name": "Contoso Ltd"})

   # Get a record
   record = client.records.get("account", guid, select=["name"])

   # Update a record
   client.records.update("account", guid, {"telephone1": "555-0100"})

   # Delete a record
   client.records.delete("account", guid)
TableOperations

Namespace for table-level metadata operations.

Accessed via client.tables. Provides operations to create, delete, inspect, and list Dataverse tables, as well as add and remove columns.

Example:


   client = DataverseClient(base_url, credential)

   # Create a table
   info = client.tables.create(
       "new_Product",
       {"new_Price": "decimal", "new_InStock": "bool"},
       solution="MySolution",
   )

   # List tables
   tables = client.tables.list()

   # Get table info
   info = client.tables.get("new_Product")

   # Add columns
   client.tables.add_columns("new_Product", {"new_Rating": "int"})

   # Remove columns
   client.tables.remove_columns("new_Product", "new_Rating")

   # Delete a table
   client.tables.delete("new_Product")