|
BatchDataFrameOperations
|
用于批处理记录操作的面向数据帧的包装器。
提供create并updatedelete接受pandas.DataFrame / pandas.Series输入并将其转换为标准听写,然后再排队批处理。 这样,数据科学调用方就可以直接将数据帧馈送到批处理中,而无需手动转换。
通过 batch.dataframe 访问。
示例:
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
|
批处理操作的命名空间(client.batch)。
通过 client.batch 访问。 用于 new 创建 BatchRequest 生成器。
示例:
batch = client.batch.new()
batch.records.create("account", {"name": "Fabrikam"})
result = batch.execute()
|
|
BatchQueryOperations
|
对 .. 的 BatchRequest查询操作
client.query镜像完全相同:相同的方法名称、相同的签名。
所有方法返回 None;结果通过 BatchResult.
不直接实例化;use batch.query.
|
|
BatchRecordOperations
|
记录对 a BatchRequest. 的操作
client.records镜像:相同的方法名称、相同的签名。
所有方法都返回None;结果可通过之后execute获得BatchResult。
GA 方法: retrieve (单记录)和 list (多记录、单页)。
get 已弃用 - 请改用 retrieve 。
不直接实例化;use batch.records.
|
|
BatchRequest
|
用于构造和执行 Dataverse OData $batch 请求的生成器。
通过 new (client.batch.new()) 获取。 添加通过 records、 tables、 query和 dataframe(可选)写入到 a changeset,然后调用 execute的操作。
操作按添加的顺序按顺序执行。 生成的每个 BatchResult HTTP 请求都已调度一个 BatchItemResponse (某些操作扩展到多个请求)。
注释
每个批处理最多 1000 个 HTTP 操作。
示例:
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, {
"[email protected]": ref
})
result = batch.execute()
|
|
BatchTableOperations
|
对 . 的 BatchRequest表元数据操作
client.tables镜像完全相同:相同的方法名称、相同的签名。
所有方法返回 None;结果通过 BatchResult.
注释
tables.delete、tables.add_columns 和 tables.remove_columns
需要元数据查找 (GET EntityDefinitions)
execute 解析表的 MetadataId 的时间。
此查找对调用方是透明的。
注释
每个生成一个tables.add_columns和tables.remove_columns
每个列的批处理项,因此它们为多个条目贡献
responses。
不直接实例化;use batch.tables.
|
|
ChangeSet
|
单记录写入操作的事务组。
所有操作都成功或回滚在一起。 用作上下文管理器或直接添加操作的调用 records 。
不直接实例化;use changeset.
示例:
with batch.changeset() as cs:
ref = cs.records.create("contact", {"firstname": "Alice"})
cs.records.update("account", account_id, {
"[email protected]": ref
})
|
|
ChangeSetRecordOperations
|
记录在一个 ChangeSet. 内可用的写入操作。
镜像 client.records 但仅限于单记录窗体(无批量创建/更新/删除)。 仅允许写入操作 - 不允许在变更集中使用 GET。
不直接实例化;use ChangeSet.records.
|
|
DataFrameOperations
|
pandas 数据帧 CRUD 操作的命名空间。
通过 client.dataframe 访问。 围绕记录级 CRUD 操作提供面向 DataFrame 的包装器。
示例:
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
|
文件操作的命名空间。
通过 client.files 访问。 为 Dataverse 文件列提供文件上传操作。
示例:
client = DataverseClient(base_url, credential)
client.files.upload(
"account", account_id, "new_Document", "/path/to/file.pdf"
)
|
|
QueryOperations
|
查询操作的命名空间。
通过 client.query 访问。 针对 Dataverse 表提供查询和搜索操作。
示例:
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
|
记录级 CRUD 操作的命名空间。
通过 client.records 访问。 提供对单个 Dataverse 记录的创建、更新、删除和获取操作。
示例:
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
|
表级元数据操作的命名空间。
通过 client.tables 访问。 提供创建、删除、检查和列出 Dataverse 表以及添加和删除列的操作。
示例:
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")
|