SalesforceBulkOperator

使用 SalesforceBulkOperator 执行 Bulk API。

使用操作员

您可以使用此操作员访问 Bulk Insert API

tests/system/providers/salesforce/example_bulk.py[源代码]

bulk_insert = SalesforceBulkOperator(
    task_id="bulk_insert",
    operation="insert",
    object_name="Account",
    payload=[
        {"Id": "000000000000000AAA", "Name": "account1"},
        {"Name": "account2"},
    ],
    external_id_field="Id",
    batch_size=10000,
    use_serial=False,
)

您可以使用此操作员访问 Bulk Update API

tests/system/providers/salesforce/example_bulk.py[源代码]

bulk_update = SalesforceBulkOperator(
    task_id="bulk_update",
    operation="update",
    object_name="Account",
    payload=[
        {"Id": "000000000000000AAA", "Name": "account1"},
        {"Id": "000000000000000BBB", "Name": "account2"},
    ],
    batch_size=10000,
    use_serial=False,
)

您可以使用此操作员访问 Bulk Upsert API

tests/system/providers/salesforce/example_bulk.py[源代码]

bulk_upsert = SalesforceBulkOperator(
    task_id="bulk_upsert",
    operation="upsert",
    object_name="Account",
    payload=[
        {"Id": "000000000000000AAA", "Name": "account1"},
        {"Name": "account2"},
    ],
    external_id_field="Id",
    batch_size=10000,
    use_serial=False,
)

您可以使用此操作员访问 Bulk Delete API

tests/system/providers/salesforce/example_bulk.py[源代码]

bulk_delete = SalesforceBulkOperator(
    task_id="bulk_delete",
    operation="delete",
    object_name="Account",
    payload=[
        {"Id": "000000000000000AAA"},
        {"Id": "000000000000000BBB"},
    ],
    batch_size=10000,
    use_serial=False,
)

此条目有帮助吗?