Use when content is about querying or scanning Amazon DynamoDB managed database.
Questions tagged [dynamodb-queries]
1232 questions
2
votes
2 answers
How pass a List of Keys to DynamoDB enhanced library and to be able to use BatchGetItem
Officially, This is the example code using java:
BatchGetResultPageIterable batchResults = enhancedClient.batchGetItem(r -> r.addReadBatch(ReadBatch.builder(Customer.class)
…

EdwinCab
- 361
- 1
- 3
- 17
2
votes
2 answers
Getting most recent item as decided by sort key for a set of hash keys
In my DynamoDB table my primary key is composed of a partition key (documentId - string) and sort key (revision - string).
documentId | revision | details (JSON)
A | 5 | { title: "Where's Wally New" }
A | 2 | { title:…

friartuck
- 2,954
- 4
- 33
- 67
2
votes
2 answers
DynamoDB - Get all items which overlap a search time interval
My application manages bookings of a user. These bookings are composed by a start_date and end_date, and their current partition in dynamodb is the following:
PK SK DATA
USER#1#BOOKINGS BOOKING#1 {s:…

gio
- 801
- 3
- 15
- 27
2
votes
0 answers
can dynamodb query for data with a list contains object that match some attribute?
can dynamodb query data for list contains object that match some attribute?
my data format:
[{
pk,
sk,
gsi1pk: 'USER',
gsi1sk,
list:[
{
id,
type, // admin, moderator, user
name,
…

Calvin Chang
- 21
- 1
2
votes
1 answer
DynamoDB | How to update an item, if the item does not exist yet with PartiQL?
I would like to make an update call to dynamoDB which:
If the ddb item exists, update the existing string set for its new values (adding not replacing),
or if the ddb item does not exist yet, create a new item.
But both cases should be covered with…

MJey
- 345
- 3
- 16
2
votes
0 answers
Increment a number in dynamoDB
I want to increment a number value 'count' in dynamoDB.
The problem I've is that I'm not sure if the key (pk,sk) actually exists.
for a given
- if exists increment it by 1
- if it is not exists add
I can…

omer727
- 7,117
- 6
- 26
- 39
2
votes
1 answer
Cannot import dynamodbv2 libraries in java
I'm trying to set up a simple Java application that queries from a Dynamo DB table but I'm getting import errors relating to dynamodbv2.
I've posted my pom.xml and Test.java, as well as the AWS docs that I've used below.
Resources Used
Maven…

Steve
- 11,831
- 14
- 51
- 63
2
votes
0 answers
How to do a query like [a between (...) or b between (..) ] in dynamodb
I have some records like
{
PKey,
...,
startTime,
endTime
}
I need to query all data with starttime or endtime within a date range.
With SQL i can do this select * from table where startTime between (a, b) or endTime between (a, b).
So how to do this…

Cheng Yi
- 21
- 1
2
votes
2 answers
Using millisecond timestamp as the global secondary index in DynamodDb for range queries?
We have a Dynamodb table Events with about 50 million records that look like this:
{
"id": "1yp3Or0KrPUBIC",
"event_time": 1632934672534,
"attr1" : 1,
"attr2" : 2,
"attr3" : 3,
...
"attrN" : N,
}
The Partition Key=id and there is no Sort…

J-Deq87
- 101
- 10
2
votes
2 answers
Wy do I get an error when issuing QueryCommand in nodejs sdk v3?
I am using aws node.js sdk v3. I want to do a simple query on the table using dynamodbdocumentclient. I wanted to do just a test if query works on a simple music table which is provided by aws developer guide.
const data = await…

fewfew
- 231
- 2
- 10
2
votes
1 answer
Does DynamoDB partition key have to be unique?
I would like to create a table for orders in dynamodb ,each order is composed of (UserID, date, Unique ID, products and total) and I want to query the orders of specific user using userId sorted by date and i want to know how can I choose my…

Ahmed gameel
- 25
- 1
- 3
2
votes
1 answer
How to update nested object in DynamoDB
My DynamoDB schema sample below:
{
obj : {
"count" : 3,
"id" : [ "X123", "X234", "X233"]
}
}
New Id : ["X007"]
Now I need to update obj attribute by incrementing count & update new item in list. How…

Error 404
- 75
- 2
- 10
2
votes
1 answer
AWS DynamoDB filter expression to filter by a particular field in an object within a list
Suppose I have the following database schema for each item:
{
config: [
{
value1: "value_1"
value2: "value_2"
}
]
}
For each item in the database, there is a field config with each of the item in its list being an object. Are…

Jarrett
- 486
- 7
- 13
2
votes
0 answers
DynamoDb Query API Vs PartiQL - RCU's
Working on a service which queries DynamoDB for items with a given Hash Key and multiple Range Key prefix filter(starts with).
We are making multiple query operation to dynamo with the Hash key and the required range key prefix. As we understand,…

optimus
- 33
- 5
2
votes
1 answer
DynamoDB date GSI
I have a DynamoDB table that stores executions of some programs, this is what it looks like:
Partition Key
Sort Key
StartDate
...
program-name
execution-id (uuid)
YYYY-MM-DD HH:mm:ss
...
I have two query scenarios for this table:
Query…

Pedro Henrique
- 680
- 7
- 22