Skip to main content

pdsx._internal.batch

batch operations for concurrent CRUD operations.

Functions

batch_delete

batch_delete(client: AsyncClient, uris: list[str]) -> BatchResult
delete multiple records concurrently. Args:
  • client: authenticated atproto client
  • uris: list of record URIs to delete
  • concurrency: maximum concurrent operations (default: 10)
  • fail_fast: stop on first error (default: False)
  • show_progress: show progress bar (default: True)
Returns:
  • batch result with successful and failed operations

batch_create

batch_create(client: AsyncClient, collection: str, records: list[dict[str, RecordValue]]) -> BatchResult
create multiple records concurrently. Args:
  • client: authenticated atproto client
  • collection: collection name
  • records: list of record data dictionaries
  • concurrency: maximum concurrent operations (default: 10)
  • fail_fast: stop on first error (default: False)
  • show_progress: show progress bar (default: True)
Returns:
  • batch result with successful URIs and failed operations

batch_update

batch_update(client: AsyncClient, updates: list[tuple[str, dict[str, RecordValue]]]) -> BatchResult
update multiple records concurrently. Args:
  • client: authenticated atproto client
  • updates: list of (uri, updates_dict) tuples
  • concurrency: maximum concurrent operations (default: 10)
  • fail_fast: stop on first error (default: False)
  • show_progress: show progress bar (default: True)
Returns:
  • batch result with successful URIs and failed operations

read_uris_from_stdin

read_uris_from_stdin() -> list[str]
read URIs from stdin, one per line. Returns:
  • list of URIs read from stdin

read_records_from_stdin

read_records_from_stdin() -> list[dict[str, RecordValue]]
read JSONL records from stdin, one JSON object per line. Returns:
  • list of record dictionaries parsed from JSONL
Raises:
  • ValueError: if JSON parsing fails

read_updates_from_stdin

read_updates_from_stdin() -> list[tuple[str, dict[str, RecordValue]]]
read JSONL update records from stdin. each line should be a JSON object with a ‘uri’ field and update fields. Returns:
  • list of (uri, updates_dict) tuples
Raises:
  • ValueError: if JSON parsing fails or uri field is missing

display_batch_result

display_batch_result(result: BatchResult, operation: str = 'deleted') -> None
display batch operation results. Args:
  • result: batch operation result
  • operation: operation name for display (e.g., “deleted”, “updated”)

Classes

BatchResult

result of a batch operation. Methods:

total

total(self) -> int
total operations attempted.

success_rate

success_rate(self) -> float
success rate as percentage.