我是AWS DynamoDB的新手,我想按属性扫描列表,并且列表包含对象。
{
ID: 1,
MESSAGE: "HELLO WORLD!",
ITEMS: [
{
ITEMS_ID: "First",
DETAILS: "new item"
},
{
ITEMS_ID: "Second",
DETAILS: "old item"
}
]
}
我尝试了全对象扫描。
dynamo_db = boto3.resource(source_db, region_name=region)
dynamo_table = dynamo_db.Table(table_name)
response = dynamo_table.scan(
FilterExpression="contains (#items, :itemVal)",
ExpressionAttributeNames={
"#items": "items"
},
ExpressionAttributeValues={
":itemVal": {
"ITEM_ID": "First",
"DETAILS" : "new item"
}
}
)
我只需要扫描“ ITEM_ID”而不是完整的对象?