|
BatchDataFrameOperations
|
バッチ レコード操作用の DataFrame 指向ラッパー。
バッチにエンキューする前に、pandas.DataFrame / pandas.Series入力を受け入れ、標準のディクテーションに変換するcreate、update、およびdeleteを提供します。 これにより、データ サイエンスの呼び出し元は、データフレームを手動で変換せずにバッチに直接フィードできます。
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経由で到着します。
直接インスタンス化しないでください。 batch.queryを使用します。
|
|
BatchRecordOperations
|
BatchRequestに対する操作を記録します。
ミラー client.records: 同じメソッド名、同じシグネチャ。
すべてのメソッドはNoneを返します。結果は、execute後にBatchResultを介して使用できます。
GA メソッド: retrieve (単一レコード) と list (マルチレコード、単一ページ)。
get は非推奨です。代わりに retrieve を使用してください。
直接インスタンス化しないでください。 batch.recordsを使用します。
|
|
BatchRequest
|
Dataverse OData $batch 要求を構築して実行するためのビルダー。
new (client.batch.new()) を使用して取得します。
records、tables、query、dataframeを使用して操作を追加し、必要に応じて書き込みをchangesetにグループ化してから、executeを呼び出します。
操作は、追加された順序で順番に実行されます。 結果の BatchResult には、ディスパッチされた HTTP 要求ごとに 1 つの BatchItemResponse が含まれます (一部の操作は複数の要求に拡張されます)。
Note
バッチあたり最大 1,000 の 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, {
"primarycontactid@odata.bind": ref
})
result = batch.execute()
|
|
BatchTableOperations
|
BatchRequestに対するテーブル メタデータ操作。
ミラー client.tables まったく同じメソッド名、同じシグネチャです。
すべてのメソッドは Noneを返します。結果は BatchResult経由で到着します。
Note
tables.delete、tables.add_columns、tables.remove_columns
にメタデータ検索 (GET EntityDefinitions) が必要です。
execute テーブルの MetadataId を解決する時間。
この参照は呼び出し元に対して透過的です。
Note
tables.add_columnsとtables.remove_columnsそれぞれ 1 つを生成します
1 列あたりのバッチ 項目数が多く、複数のエントリが
responses。
直接インスタンス化しないでください。 batch.tablesを使用します。
|
|
ChangeSet
|
単一レコード書き込み操作のトランザクション グループ。
すべての操作が成功するか、一緒にロールバックされます。 コンテキスト マネージャーとして使用するか、 records を呼び出して操作を直接追加します。
直接インスタンス化しないでください。 changesetを使用します。
例:
with batch.changeset() as cs:
ref = cs.records.create("contact", {"firstname": "Alice"})
cs.records.update("account", account_id, {
"primarycontactid@odata.bind": ref
})
|
|
ChangeSetRecordOperations
|
ChangeSet内で使用できる書き込み操作を記録します。
ミラー client.records が、単一レコード フォームに制限されます (一括作成/更新/削除は行われません)。 書き込み操作のみが許可されます。GET は変更セット内では許可されません。
直接インスタンス化しないでください。 ChangeSet.recordsを使用します。
|
|
DataFrameOperations
|
pandas DataFrame 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")
|