amazon-dynamodb

"Internal Server Error" when querying of DynamoDB in Lambda using Python

"Internal Server Error" when querying of DynamoDB in Lambda using Python Question: I am currently trying to read my dynamodb table "saved_measurements" with the partition key "Name". I’m doing this through API Gateway Lambda proxy integration, and have tested my event[‘pathParameters’][‘name’] to be working just fine so that shouldn’t be the issue. However, when I …

Total answers: 1

CDK Table DynamoDB, Stream configuration Python

CDK Table DynamoDB, Stream configuration Python Question: In terraform, it works passing the attributes directly in CDK does not work. Does anyone know how to activate the stream in the DynamoDB table? stream_enabled = true stream_view_type = "NEW_AND_OLD_IMAGES" Asked By: Junior Osho || Source Answers: I assume you are asking how to do so in …

Total answers: 2

AWS DynamoDB execute_statement Without Data Types in Python

AWS DynamoDB execute_statement Without Data Types in Python Question: I am using boto3 to query my DynamoDB table using PartiQL, dynamodb = boto3.client( ‘dynamodb’, aws_access_key_id='<aws_access_key_id>’, aws_secret_access_key='<aws_secret_access_key>’, region_name='<region_name>’ ) resp = dynamodb.execute_statement(Statement=’SELECT * FROM TryDaxTable’) Now, the response you get contains a list of dictionaries that looks something like this, {‘some_data’: {‘S’: ‘XXX’}, ‘sort_key’: {‘N’: ‘1’}, …

Total answers: 1

Hardcoded Credentials for Dynamodb AWS Queries

Hardcoded Credentials for Dynamodb AWS Queries Question: I have a script which checks if a specific value is inside a cell in a dynamodb table in AWS. I used to add hardcoded credentials containing the secret key in my script such as this: dynamodb_session = Session(aws_access_key_id=’access_key_id’, aws_secret_access_key=’secret_access_key’, region_name=’region’) dynamodb = dynamodb_session.resource(‘dynamodb’) table=dynamodb.Table(‘table_name’) Are there any …

Total answers: 1

Appending list not working for AWS DynamoDB using Python boto3

Appending list not working for AWS DynamoDB using Python boto3 Question: I’m trying to append a value to a DynamoDB table entry: { "id": "1", "history": [ "638380895-8" ], "currentbooks": "", "email": "[email protected]", "name": "Osborne Comford" } I’m trying to write the code to add a string entry to ‘history’ array. Following is my python …

Total answers: 2

How to query DynamoDB filtering by value in a list

How to query DynamoDB filtering by value in a list Question: There are three items in database: [ { "year": 2013, "info": { "genres": ["Action", "Biography"] } }, { "year": 2013, "info": { "genres": ["Crime", "Drama", "Thriller"] } }, { "year": 2013, "info": { "genres": ["Action", "Adventure", "Sci-Fi", "Thriller"] } } ] With the year …

Total answers: 3

How to create a User class for Flask-Login when using dynamodb?

How to create a User class for Flask-Login when using dynamodb? Question: I am following the tutorial at https://www.digitalocean.com/community/tutorials/how-to-add-authentication-to-your-app-with-flask-login for adding register/login features to a flask app, which uses Flask-Login with an SQLite database (using flask_sqlalchemy). As such, it has code like the following for initializing the SQLite database (from init.py): db = SQLAlchemy() def …

Total answers: 2

How to create the dynamodb table using serverless.yml and delete the items of it using python boto3?

How to create the dynamodb table using serverless.yml and delete the items of it using python boto3? Question: I’ve created the dynamodb table using serverless.yml as below: resources: Resources: myTable: Type: AWS::DynamoDB::Table DeletionPolicy: Retain Properties: TableName: myTable AttributeDefinitions: – AttributeName: id AttributeType: S – AttributeName: firstname AttributeType: S – AttributeName: lastname AttributeType: S KeySchema: – …

Total answers: 3

boto3 DynamoDB update_item() API creates a new item (with range key) instead of updating it

boto3 DynamoDB update_item() API creates a new item (with range key) instead of updating it Question: I am trying a simple operation on my DynamoDB table. The schema is very simple (Hash Key) SummaryId : String (Sort Key) Status : String def put_item(dynamo_table, summary_id, status): return dynamo_table.put_item( Item={ ‘SummaryId’: summary_id, ‘Status’: status }, ReturnValues="ALL_OLD" ) …

Total answers: 1