Questions tagged [dynamodb-queries]

Use when content is about querying or scanning Amazon DynamoDB managed database.

1232 questions
2
votes
0 answers

How paginate DynamoDb scan result from Lambda function in typescript?

I have a problem whit query/scan operation in DynamoDb. I'm using the dynamodb-data-mapper whit aws-data-mapper-annotations in order to do operations whit the database. I have a Lambda function which have to get all the items from a table (in this…
2
votes
1 answer

How to sort and filter by createdAt and updatedAt in aws AppSync?

I used AWS Amplify to create an GraphQL API. In DynamoDB the fields createdAt and updatedAt are created automatically. I have no way of filter values for this fields with Appsync. I would like to query data with appsync with filter range between two…
2
votes
2 answers

DynamoDB: Query a secondary index with prefix (begins_with) only

I want to a DynamoDB query for a string that's not a part of the primary key and I only have this string. As an example I have Music Artist: String, PrimaryKey(HASH) SongTitle: String, PrimaryKey(RANGE) AlbumTitle: String,…
2
votes
1 answer

Query dynamodb with begins_with

I have a table created with the serverless framework: resources: Resources: withdawlRequestTable: Type: AWS::DynamoDB::Table Properties: TableName: ${self:provider.environment.WITHDRAWAL_REQUEST_TABLE} …
0xtuytuy
  • 1,494
  • 6
  • 26
  • 51
2
votes
1 answer

Filtering records on the basis of TTL

In my DynamoDb table I have set TTL column name to be "ttl". I am using below mentioned Java code to apply filter on ttl but getting exception. "Invalid FilterExpression: Attribute name is a reserved keyword; reserved keyword: ttl (Service:…
Akhil
  • 75
  • 2
  • 8
2
votes
1 answer

How to query conditional attributes in DynamoDB

I'm trying to query all the Food values in the "Categories" attribute and the "review_count" attribute values that are at least 100. My first time working with scanning tables in DynamoDB through python. I need to use the table.scan function as…
2
votes
1 answer

Deleting DynamoDB items in a paginated query loop

When querying a DynamoDB table, you may get back a LastEvaluatedKey parameter, indicating that the result is paginated and that LastEvaluatedKey is the primary key of the last item that was processed in this page. To fetch the next page,…
JHH
  • 8,567
  • 8
  • 47
  • 91
2
votes
1 answer

What is the proper syntax to get() entries where the sort key begins with a substring using AWS.DynamoDB.DocumentClient in NodeJS?

What is the proper syntax to query database entries whose sort key starts with a specific string? I believe it's something along the lines of const query_params = { TableName: 'my_table', Key: { my_primary_key: 'a_primary_key_value', …
2
votes
1 answer

Update list items in dynamodb

My data structure in AWS DynamoDB looks like this: { key: 'roomNameOne', value: { attendees: ['A', 'B', 'C'] // this is a set, wsConnections: [{ connectiondId: 'foo', domain: 'xyz.com' }, { connectiondId: 'bar', domain: 'xyz.com' }] …
2
votes
0 answers

DynamoDB Query with Global Secondary Index throws 'ValidationException: Query key condition not supported'

When trying to execute the query from the AppSync console in AWS, the following error keeps popping up, as seen in the logs of CloudWatch: 'ValidationException: Query key condition not supported' I have tried changing the schema with different types…
2
votes
1 answer

How to make several conditions on sort key with dynamodb queries?

In their documentation AWS says about KeyConditionExpression for queries : The condition can optionally perform one of several comparison tests on a single sort key value. This allows Query to retrieve one item with a given partition key value and…
2
votes
1 answer

DynamoDB Enhanced - No result from query

I have below two test cases implemented to test DynamoDB enhanced library. Test case 1: Use Get Item on table "digital_form", with PK = "FORM#ABC123" and SK = "INFO#ABC123". which can return result @Test public void testGetItemWithPKSK()…
2
votes
1 answer

How to get one Item by searching from non-key attribute in DynamoDB?

I have a table in DynamoDB and have partition key and a sort key. For example, the table structure is as follows. // Primary Keys id -> PK name -> SK Info -> json Formatted Attributes So let's say there are two items in the table, // Item 1 { …
2
votes
0 answers

How to generate a reliable `hasMoreResults` value for pagination in DynamoDB queries

I am trying to perform pagination on a simple DynamoDB table for queries by date range, and had hoped to coerce the LastEvaluatedKey into a "hasMoreResults" boolean value for my front end to consume, but now see that a non-empty LastEvaluatedKey can…
2
votes
1 answer

Using DynamoDB transact_write_items how to update multiple items of a table using Composite primary key?

I want to update multiple items in the table based on conditions of primary key and sort key. Is it possible to achieve this using transact_write_items? I have a table with Primary key as p_name and sort key as a_id. I would have to update a_status…