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.

Note

This function has arguments which can be configured globally through wr.config or environment variables:

Check out the Global Configurations Tutorial for details.

Parameters:
  • path (Union[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 (boto3.Session(), optional) – Boto3 Session. The default boto3 Session will be used if boto3_session receive None.

  • use_threads (Union[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.

Returns:

None.

Return type:

None

Examples

Writing contents of JSON file

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