StartTableDataImportJob - Amazon Honeycode

StartTableDataImportJob

The StartTableDataImportJob API starts a table data import job that runs in the background. Once the job is started, you can use the DescribeTableDataImportJob API to find the status of the import.

To find more details about using this API check the StartTableDataImportJob API Reference page.

The following example shows how to import a CSV file to the Stocks table. First, create a CSV file with contents as follows:

Symbol,Price,Previous Price,Last Update AAA,123.17,182.21,11/9/20 6:23 PM BBB,127.27,128.13,11/9/20 6:23 PM

Upload this CSV to an S3 bucket. Use the following AWS CLI command to generate a presigned URL for the CSV. Be sure to replace with the S3 bucket name and with the name of the file you uploaded.

aws s3 presign s3://<bucket-name>/<file-name>

Copy the presigned URL from the output. This URL will need to be passed in as a parameter in the call to StartTableDataImportJob API. Now the file is ready for import. In the examples below, replace <workbook-id> with your workbook id.

AWS CLI Example

aws honeycode start-table-data-import-job \ --workbook-id '<workbook-id>' \ --destination-table-id '<table-id>' \ --dataSource '{ "dataSourceConfig": {"dataSourceUrl": "<presigned-url>" } }' \ --dataFormat 'DELIMITED_TEXT' \ --import-options '{ "destinationOptions": { "columnMap": { "<symbol-column-id>": { "columnIndex": 1 }, "<price-column-id>": { "columnIndex": 2 }, "<previous-price-column-id>": { "columnIndex": 3 }, "<last-update-column-id>": { "columnIndex": 4 } } }, "delimitedTextOptions": { "delimiter": ",", "hasHeaderRow": true, "ignoreEmptyRows": true, "dataCharacterEncoding": "UTF-8" } }' \ --client-request-token '<request-token>'

Python SDK Example

response = honeycode_client.start_table_data_import_job( workbookId = '<workbook-id>', destinationTableId = '<table-id>', dataSource = { "dataSourceConfig": {"dataSourceUrl": "<presigned-url>" } }, dataFormat = 'DELIMITED_TEXT', importOptions = { "destinationOptions": { "columnMap": { "<symbol-column-id>": { "columnIndex": 1 }, "<price-column-id>": { "columnIndex": 2 }, "<previous-price-column-id>": { "columnIndex": 3 }, "<last-update-column-id>": { "columnIndex": 4 } } }, "delimitedTextOptions": { "delimiter": ",", "hasHeaderRow": true, "ignoreEmptyRows": true, "dataCharacterEncoding": "UTF-8" } }, clientRequestToken = '<request-token>')

Response

{ "jobId": "<job-id>", "jobStatus": "SUBMITTED" }