You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unsure if it's used to work or intended, but I notice that moto allows DynamoDB's table name to be surround by single quotation marks. This is not the case on an real DynamoDB.
Traceback (most recent call last): File "/Users/khanh.le/Git/mototest/main.py", line 15, in <module> execute_statement() File "/Users/khanh.le/Git/mototest/main.py", line 8, in execute_statement response = client.execute_statement(Statement=f"select pk from '{table_name}'") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/khanh.le/Git/mototest/.venv/lib/python3.12/site-packages/botocore/client.py", line 569, in _api_call return self._make_api_call(operation_name, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/khanh.le/Git/mototest/.venv/lib/python3.12/site-packages/botocore/client.py", line 1023, in _make_api_call raise error_class(parsed_response, operation_name)botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the ExecuteStatement operation: Unexpected from source
But running moto_test.py returns a successful test.
A quick check on PartiQL Editor on AWS console also shows some kind of errors when I try surround the table name with single quotation mark.
I looked into this at some point, and I remember being.. bewildered by AWS' choices.
Not sure about the details - was it that AWS allows both no quotes or double quotes, but not single quotes? Either that, or there were inconsistencies in what types of quotes they accept/require for other parts of the query, like attributes.
It is confusing either way, and it would be nice if we could at least match the behaviour, so I'll mark it as an enhancement to add this validation.
Unsure if it's used to work or intended, but I notice that
moto
allows DynamoDB's table name to be surround by single quotation marks. This is not the case on an real DynamoDB.Given
main.py
and
main_test.py
Running
main.py
return this errorBut running
moto_test.py
returns a successful test.A quick check on PartiQL Editor on AWS console also shows some kind of errors when I try surround the table name with single quotation mark.
SELECT
UPDATE
DELETE
INSERT
The text was updated successfully, but these errors were encountered: