awswrangler.dynamodb.put_json

awswrangler.dynamodb.put_json(path: str | Path, table_name: str, boto3_session: Session | None = None, use_threads: bool | int = True) None

Write all items from JSON file to a DynamoDB.

The JSON file can either contain a single item which will be inserted in the DynamoDB or an array of items which all be inserted.

Parameters:
  • path (str | Path) – Path as str or Path object to the JSON file which contains the items.

  • table_name (str) – Name of the Amazon DynamoDB table.

  • boto3_session (Session | None) – The default boto3 session will be used if boto3_session is None.

  • use_threads (bool | int) – Used for Parallel Write requests. True (default) to enable concurrency, False to disable multiple threads. If enabled os.cpu_count() is used as the max number of threads. If integer is provided, specified number is used.

Return type:

None

Examples

Writing contents of JSON file

>>> import awswrangler as wr
>>> wr.dynamodb.put_json(
...     path='items.json',
...     table_name='table'
... )