查询多个值
Querying multiple values
我正在尝试按多个值进行过滤,但我似乎无法使用 and 子句(例如 filter1 和 filter 2 ...等):
显示数据库名称为 'testing'
的快照
aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBInstanceIdentifier==`testing`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[
{
"SNAPSHOT": "test1",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test2",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test3",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test4",
"DBNAME": "testing"
}
]
显示名为 'test1'
的快照
$ aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBSnapshotIdentifier==`test1`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[
{
"SNAPSHOT": "test1",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test1",
"DBNAME": "testing2"
}
]
显示数据库测试中名为 test1 的快照
aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBInstanceIdentifier==`testing`][?DBSnapshotIdentifier==`test1`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[]
如何实现?
您需要与 AND
expression 一起工作,这样才能成功
$ aws rds describe-db-snapshots --include-shared \
--query 'DBSnapshots[?(DBInstanceIdentifier==`testing` && DBSnapshotIdentifier==`test1`)].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
我正在尝试按多个值进行过滤,但我似乎无法使用 and 子句(例如 filter1 和 filter 2 ...等):
显示数据库名称为 'testing'
的快照aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBInstanceIdentifier==`testing`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[
{
"SNAPSHOT": "test1",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test2",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test3",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test4",
"DBNAME": "testing"
}
]
显示名为 'test1'
的快照$ aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBSnapshotIdentifier==`test1`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[
{
"SNAPSHOT": "test1",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test1",
"DBNAME": "testing2"
}
]
显示数据库测试中名为 test1 的快照
aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBInstanceIdentifier==`testing`][?DBSnapshotIdentifier==`test1`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[]
如何实现?
您需要与 AND
expression 一起工作,这样才能成功
$ aws rds describe-db-snapshots --include-shared \
--query 'DBSnapshots[?(DBInstanceIdentifier==`testing` && DBSnapshotIdentifier==`test1`)].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'