SalesforceBulkOperator

Use the SalesforceBulkOperator to execute Bulk API.

Using the Operator

You can use this operator to access Bulk Insert API:

tests/system/salesforce/example_bulk.py[source]

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,
)

You can use this operator to access Bulk Update API:

tests/system/salesforce/example_bulk.py[source]

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,
)

You can use this operator to access Bulk Upsert API:

tests/system/salesforce/example_bulk.py[source]

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,
)

You can use this operator to access Bulk Delete API:

tests/system/salesforce/example_bulk.py[source]

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

Was this entry helpful?