我们可以使用 PartiQL 从 DynamoDB 查询前 n 行吗?

0

【以下的问题经过翻译处理】 我正在尝试使用 PartiQL 从 DynamoDB 中获取前 5 行,但找不到任何语法,或者我可能遗漏了一些语法。 我的要求是仅通过 PartiQL 使用它,而不是通过任何文档模型或客户端库使用它。

profile picture
EXPERT
asked 8 months ago30 views
1 Answer
0

【以下的回答经过翻译处理】 为了满足您的需要,您可以使用 PartiQL 的 Limit 参数,您可以在其中将结果限制为 n 行:

https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ExecuteStatement.html#DDB-ExecuteStatement-request-Limit

例子:

const params = {
   "Limit": 3,
   "Statement": "SELECT * FROM mytable"
}

const result = client.executeStatement(params).promise()

profile picture
EXPERT
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions