I am trying to get all rows past a certain time stamp.
I have also tried using "GE", "LE", "GT" in the condition but I get a syntax error.
I get the following DynamoDB error:
Internal Server Error [ValidationException: Query key condition not supported
status code: 400,
I have the following table
Table name GroupsLambda3
Primary partition key id (String)
Primary sort key -
Point-in-time recovery DISABLEDEnable
Encryption Type DEFAULTManage Encryption
KMS Master Key ARN Not Applicable
Time to live attribute DISABLEDManage TTL
Then I have created asecondary index on
Name: unix_time-index
Status: Active
Type: GSI
Partition Key: unix_time (Number)
Sort Key: unix_time-index
Finally my Golang code is:
var cond string
cond = "unix_time <= :v_unix_time"
var projection string
projection = "id, num_users, salesforce_campaign, unix_time"
input := &dynamodb.QueryInput{
TableName: aws.String(table),
IndexName: aws.String("unix_time-index"),
KeyConditionExpression: &cond,
ProjectionExpression: &projection,
ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
":v_unix_time": {
N: aws.String("1558130473454419"),
},
},
The code works when I do cond = "unix_time = :v_unix_time"
, equals only.
I expect all rows with a lesser unix_timestamp.