我试图让所有行都超过某个时间戳。
我也尝试在条件中使用“GE”、“LE”、“GT”,但出现语法错误。
我收到以下 DynamoDB 错误:
Internal Server Error [ValidationException: Query key condition not supported
status code: 400,
我有下表
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
然后我创建了一个二级索引
Name: unix_time-index
Status: Active
Type: GSI
Partition Key: unix_time (Number)
Sort Key: unix_time-index
最后我的 Golang 代码是:
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"),
},
},
当我这样做时,代码有效cond = "unix_time = :v_unix_time",仅等于。
我希望所有行都具有较小的 unix_timestamp。
慕容708150
相关分类