Skip to content

Documentation missing information on required schema for dataframe storage in DynamoDB #882

Open
@fsiler

Description

@fsiler

Is your idea related to a problem? Please describe.
The examples provided for DynamoDB are far too brief to be of actual use. It would be easiest if there was a function create_table or whatever that could take a dataframe as input and create an appropriate storage table. At minimum, please provide a few examples of dataframes and their corresponding table setups. I get large stacktraces that don't actually help me get to the root of data modeling:

Traceback (most recent call last):
  File "/Users/fms/.pyenv/versions/3.9.6/lib/python3.9/site-packages/flask/app.py", line 2070, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/fms/.pyenv/versions/3.9.6/lib/python3.9/site-packages/flask/app.py", line 1515, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/fms/.pyenv/versions/3.9.6/lib/python3.9/site-packages/flask/app.py", line 1513, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/fms/.pyenv/versions/3.9.6/lib/python3.9/site-packages/flask/app.py", line 1499, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/Users/fms/build/fatpitch/app.py", line 113, in puts
    wr.dynamodb.put_df(df=df, table_name=USERS_TABLE, boto3_session=boto3_session)
  File "/Users/fms/.pyenv/versions/3.9.6/lib/python3.9/site-packages/awswrangler/dynamodb/_write.py", line 146, in put_df
    put_items(items=items, table_name=table_name, boto3_session=boto3_session)
  File "/Users/fms/.pyenv/versions/3.9.6/lib/python3.9/site-packages/awswrangler/dynamodb/_write.py", line 183, in put_items
    _validate_items(items=items, dynamodb_table=dynamodb_table)
  File "/Users/fms/.pyenv/versions/3.9.6/lib/python3.9/site-packages/awswrangler/dynamodb/_utils.py", line 54, in _validate_items
    raise exceptions.InvalidArgumentValue("All items need to contain the required keys for the table.")
awswrangler.exceptions.InvalidArgumentValue: All items need to contain the required keys for the table.

Describe the solution you'd like
Ideally, create_table and create_table_json functions which would take a dataframe as input and either create the table or give the necessary schema information. Documentation of how dataframes should be laid out, and how the tables can be laid out to correspond with this. A few examples. Useful error messages such as "I didn't find a 'PK' entry in your dataframe, so I can't index it against this DynamoDB table."

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions