Batch
Subrequest
¶
Composite Batch subrequest.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method |
Literal['GET', 'POST', 'PUT', 'PATCH', 'DELETE']
|
HTTP method. |
required |
url |
str
|
Request URL. |
required |
rich_input |
dict
|
Input body for the request. |
None
|
binary_part_name |
str
|
Name of the binary part in the multipart request. |
None
|
binary_part_name_alias |
str
|
The name parameter in the Content-Disposition header of the binary body part. |
None
|
Source code in src/aiosalesforce/composite/batch.py
response: dict
property
writable
¶
Subrequest response.
done: bool
property
¶
Whether the subrequest has been executed.
status_code: int
property
¶
HTTP status code of the subrequest response.
result: dict | list | None
property
¶
Subrequest result (response body).
is_success: bool
property
¶
Whether this subrequest was successful.
raise_for_status()
¶
QuerySubrequest
¶
Bases: Subrequest
SOQL query subrequest.
Source code in src/aiosalesforce/composite/batch.py
records: list[dict]
property
¶
Query records.
SobjectCreateSubrequest
¶
Bases: Subrequest
sObject create subrequest.
Source code in src/aiosalesforce/composite/batch.py
id: str
property
¶
ID of the created record.
SobjectGetSubrequest
¶
Bases: Subrequest
sObject get subrequest.
Source code in src/aiosalesforce/composite/batch.py
record: dict
property
¶
Retrieved record.
SobjectUpsertSubrequest
¶
Bases: Subrequest
sObject upsert subrequest.
Source code in src/aiosalesforce/composite/batch.py
SobjectSubrequestClient
¶
Client for sObject operations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
composite_batch_request |
CompositeBatchRequest
|
Composite Batch request. |
required |
Source code in src/aiosalesforce/composite/batch.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
|
base_path: str = '/'.join(['', 'services', 'data', f'v{self.composite_batch_request.salesforce_client.version}', 'sobjects'])
instance-attribute
¶
Base path in the format /services/data/v[version]/sobjects
create(sobject, /, data)
¶
Create a new record.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sobject |
str
|
Salesforce object name. E.g. "Account", "Contact", etc. |
required |
data |
dict | str | bytes | bytearray
|
Data to create the record with. Either a dict or a JSON string/bytes representing a dict. |
required |
Returns:
Type | Description |
---|---|
SobjectCreateSubrequest
|
Create subrequest.
Record ID can be accessed via the |
Source code in src/aiosalesforce/composite/batch.py
get(sobject, id_, /, external_id_field=None, fields=None)
¶
Get record by ID or external ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sobject |
str
|
Salesforce object name. E.g. "Account", "Contact", etc. |
required |
id_ |
str
|
Salesforce record ID or external ID (if external_id_field is provided). |
required |
external_id_field |
str
|
External ID field name, by default None. |
None
|
fields |
Iterable[str]
|
Fields to get for the record. By default returns all fields. |
None
|
Returns:
Type | Description |
---|---|
SobbjectGetSubrequest
|
Get subrequest.
Record can be accessed via the |
Source code in src/aiosalesforce/composite/batch.py
update(sobject, id_, /, data)
¶
Update record by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sobject |
str
|
Salesforce object name. E.g. "Account", "Contact", etc. |
required |
id_ |
str
|
Salesforce record ID. |
required |
data |
dict | str | bytes | bytearray
|
Data to update the record with. Either a dict or a JSON string/bytes representing a dict. |
required |
Returns:
Type | Description |
---|---|
Subrequest
|
|
Source code in src/aiosalesforce/composite/batch.py
delete(sobject, id_, /, external_id_field=None)
¶
Delete record by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sobject |
str
|
Salesforce object name. E.g. "Account", "Contact", etc. |
required |
id_ |
str
|
Salesforce record ID or external ID (if external_id_field is provided). |
required |
external_id_field |
str
|
External ID field name. If not provided, id_ is treated as a record ID. |
None
|
Returns:
Type | Description |
---|---|
Subrequest
|
|
Source code in src/aiosalesforce/composite/batch.py
upsert(sobject, id_, /, external_id_field, data, validate=True)
¶
Upsert (update if exists, create if not) record by external ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sobject |
str
|
Salesforce object name. E.g. "Account", "Contact", etc. |
required |
id_ |
str
|
Salesforce record external ID. |
required |
external_id_field |
str
|
External ID field name. |
required |
data |
dict | str | bytes | bytearray
|
Data to upsert the record with. Either a dict or a JSON string/bytes representing a dict. |
required |
validate |
bool
|
If True, validates the request and removes the external ID field from the data if it's present. By default True. The reason for this is that Salesforce does not allow payload to contain an external ID field when upserting on it. Set this to False if you know you data is correct and you want to improve performance. |
True
|
Returns:
Type | Description |
---|---|
SobjectUpsertSubrequest
|
Upsert subrequest. Exposes 'id' and 'created' properties. |
Source code in src/aiosalesforce/composite/batch.py
CompositeBatchRequest
¶
Composite Batch request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
salesforce_client |
Salesforce
|
Salesforce client. |
required |
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
|
Source code in src/aiosalesforce/composite/batch.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 |
|
sobject: SobjectSubrequestClient
cached
property
¶
Perform sObject operations.
execute()
async
¶
Execute composite batch request and set subrequests' responses.
Source code in src/aiosalesforce/composite/batch.py
query(query, include_all_records=False)
¶
Execute a SOQL query.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
SOQL query. |
required |
include_all_records |
bool
|
If True, includes all (active/deleted/archived) records. |
False
|
Returns:
Type | Description |
---|---|
QuerySubrequest
|
Query subrequest.
Records can be accessed via the |