Client
CompositeClient
¶
Salesforce REST API Composite client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
salesforce_client |
Salesforce
|
Salesforce client. |
required |
Source code in src/aiosalesforce/composite/client.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
batch(halt_on_error=False, autoraise=False, group_errors=False)
¶
Start a Comsposite Batch operation.
To execute a batch request, add subrequests to the batch and call execute
.
Alternatively, use a context manager to automatically execute the batch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
halt_on_error |
bool
|
If True, unprocessed subrequests will be halted if any subrequest fails. |
False
|
autoraise |
bool
|
If True, an exception will be raised if any subrequest fails. |
False
|
group_errors |
bool
|
Ignored if |
False
|
Returns:
Type | Description |
---|---|
CompositeBatchRequest
|
Composite Batch request. |
Examples:
>>> async with salesforce.composite.batch(halt_on_error=True) as batch:
... query = batch.query("SELECT Id, Name FROM Account LIMIT 10")
... contact = batch.sobject.create(
... "Contact",
... {"FirstName": "Jon", "LastName": "Doe"},
... )
... print(query.records)
... print(contact.id)
Source code in src/aiosalesforce/composite/client.py
__call__(all_or_none=False, collate_subrequests=False, autoraise=False)
¶
Start a Comsposite operation.
To execute a composite request, add subrequests to it and call execute
.
Alternatively, use a context manager to automatically execute the request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
all_or_none |
bool
|
If True, all subrequests are rolled back if any subrequest fails. |
False
|
collate_subrequests |
bool
|
If True, independent subrequests are executed by Salesforce in parallel. |
True
|
autoraise |
bool
|
If True, raises an ExceptionGroup if any subrequest fails. |
False
|
Returns:
Type | Description |
---|---|
CompositeRequest
|
Composite request. |
Examples:
>>> async with salesforce.composite(all_or_none=True) as batch:
... account = composite.sobject.create(
... "Account",
... {...},
... )
... contact = composite.sobject.create(
... "Contact",
... {"Account": account.reference.id, ...}
... )
... print(account.id)
... print(contact.id)