import_table#
DynamoDB import from S3 tool box.
Reference:
DynamoDB data import from Amazon S3: how it works: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/S3DataImport.HowItWorks.html
- class aws_dynamodb_io.import_table.ImportJob(arn: str, status: str, table_arn: Optional[str] = None, table_id: Optional[str] = None, client_token: Optional[str] = None, s3_bucket_owner: Optional[str] = None, s3_bucket: Optional[str] = None, s3_prefix: Optional[str] = None, error_count: Optional[int] = None, cloudwatch_log_group_arn: Optional[str] = None, input_format: Optional[str] = None, import_format_options: Optional[Dict[str, str]] = None, import_compression_type: Optional[str] = None, table_creation_parameters: Optional[Dict[str, str]] = None, start_time: Optional[datetime] = None, end_time: Optional[datetime] = None, processed_size_bytes: Optional[int] = None, processed_item_count: Optional[int] = None, imported_item_count: Optional[int] = None, failure_code: Optional[str] = None, failure_message: Optional[str] = None)[source]#
The DynamoDB import table job data model.
Ref:
import_table: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/import_table.html
describe_import: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/describe_import.html
list_imports: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/list_imports.html
How it works: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/S3DataImport.HowItWorks.html
- classmethod list_imports(dynamodb_client: DynamoDBClient, table_arn: str, page_size: int = 25, max_results: int = 1000, get_details: bool = False) List[ImportJob][source]#
- classmethod from_import_description(desc: dict)[source]#
- Parameters:
desc – The import description dictionary from
import_table,describe_importorlist_imports.
- aws_dynamodb_io.import_table.write_amazon_ion(records: Iterable[Dict[str, Any]], s3uri: str, s3_client: S3Client) PutObjectOutputTypeDef[source]#
Write records to S3, so that you can import DynamoDB table from S3 later.
This function uses the Amazon Ion format and gzip compression.
Ref:
Note
the
amazon.ionpython library doesn’t work well with the DynamoDB import table feature. Theamazon.ionlibrary will encode integer value like the standardjsonlibrary.1to1. However, the data for import table requires a “dot” after the integer, for example1.. Looks like there’s no way we can let theamazon.ionto add the “dot”. If you want to construct dataset for DynamoDB import table, don’t use ION, use DynamoDB JSON instead.- Parameters:
records – The list of python dictionary representing the dynamodb item to write to S3.
s3uri – The S3 URI to write the data to.
s3_client – The S3 client to use.
- aws_dynamodb_io.import_table.write_dynamodb_json(records: Iterable[Dict[str, Any]], s3uri: str, s3_client: S3Client) PutObjectOutputTypeDef[source]#
Write records to S3, so that you can import DynamoDB table from S3 later.
This function uses the DynamoDB JSON format and gzip compression.
Ref:
- Parameters:
records – The list of python dictionary representing the dynamodb item to write to S3.
s3uri – The S3 URI to write the data to.
s3_client – The S3 client to use.