BatchDataFrameOperations Class
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()
Constructor
BatchDataFrameOperations(batch: _BatchContext)
Parameters
| Name | Description |
|---|---|
|
batch
Required
|
|
Methods
| create |
Enqueue record creates from a pandas DataFrame. Each row becomes a record. All rows are bundled in a single
Example:
|
| delete |
Enqueue record deletes from a pandas Series of GUIDs. Example:
|
| update |
Enqueue record updates from a pandas DataFrame. Each row represents an update. The Example:
|
create
Enqueue record creates from a pandas DataFrame.
Each row becomes a record. All rows are bundled in a single
CreateMultiple batch item (one HTTP request in the batch).
Example:
df = pd.DataFrame([{"name": "Contoso"}, {"name": "Fabrikam"}])
batch.dataframe.create("account", df)
create(table: str, records: DataFrame) -> None
Parameters
| Name | Description |
|---|---|
|
table
Required
|
Table schema name (e.g. |
|
records
Required
|
DataFrame where each row is a record to create. |
Exceptions
| Type | Description |
|---|---|
|
If |
|
|
If |
delete
Enqueue record deletes from a pandas Series of GUIDs.
Example:
ids_series = pd.Series(["guid-1", "guid-2", "guid-3"])
batch.dataframe.delete("account", ids_series)
delete(table: str, ids: Series, use_bulk_delete: bool = True) -> None
Parameters
| Name | Description |
|---|---|
|
table
Required
|
Table schema name (e.g. |
|
ids
Required
|
Series of record GUIDs to delete. |
|
use_bulk_delete
|
When Default value: True
|
Exceptions
| Type | Description |
|---|---|
|
If |
|
|
If |
update
Enqueue record updates from a pandas DataFrame.
Each row represents an update. The id_column specifies which
column contains the record GUIDs.
Example:
df = pd.DataFrame([
{"accountid": "guid-1", "telephone1": "555-0100"},
{"accountid": "guid-2", "telephone1": "555-0200"},
])
batch.dataframe.update("account", df, id_column="accountid")
update(table: str, changes: DataFrame, id_column: str, clear_nulls: bool = False) -> None
Parameters
| Name | Description |
|---|---|
|
table
Required
|
Table schema name (e.g. |
|
changes
Required
|
DataFrame where each row contains a record GUID and the fields to update. |
|
id_column
Required
|
Name of the DataFrame column containing record GUIDs. |
|
clear_nulls
|
When Default value: False
|
Exceptions
| Type | Description |
|---|---|
|
If |
|
|
If |