How do I use Limit in PartiQL? What I need is the last 3 rows from the table of Amazon QLDB which uses PartiQL Syntax for querying. Something like SELECT * FROM Accounts where AddedBy = 'admin@demo.com' LIMIT 3
4 Answers
LIMIT
isn't currently supported by Amazon QLDB. Here's a more detailed answer to your question Pagination in QLDB.
Limit
is now supported in the ExecuteStatement
command. See the AWS documentation for sending it as part of the request.
Here is the announcement from March 8, 2022.

- 6,204
- 5
- 45
- 42
This is the same issue I faced. So I write a project to extend PartiQL capbilities. Please refer here: https://github.com/passren/PyDynamoDB

- 1
-
Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 12 '22 at 21:32
LIMIT works differently than I thought it would. LIMIT means you want to limit your search to that number of rows. So LIMIT=10 means you are only going to query a maximum of 10 rows.
And it does not go in the statement string, but instead in the method call. For example:
import boto3
stmt = "SELECT * FROM \"my-table\" WHERE my_key = \'some_key\'"
dynamodb = boto3.client('dynamodb', region_name='us-east-1')
resp = dynamodb.execute_statement(Statement=stmt, Limit=10)
print(resp['Items'])
Here is the documentation: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ExecuteStatement.html#API_ExecuteStatement_RequestSyntax

- 5,874
- 1
- 47
- 40