SalesforceBulkOperator

使用 SalesforceBulkOperator 执行批量 API。

使用操作符

您可以使用此操作符访问批量插入 API

tests/system/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,
)

您可以使用此操作符访问批量更新 API

tests/system/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,
)

您可以使用此操作符访问批量更新插入 API

tests/system/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,
)

您可以使用此操作符访问批量删除 API

tests/system/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,
)

此条目是否有帮助?