PartiQL select always return ValidationException: Unexpected from source

0

I have a working setup using Amplify, a lambda and dynamodb querying dynamodb the classic way with no issues.

Since yesterday I am trying to use PartiQL instead but no success, I always just get "ValidationException: Unexpected from source"

I have also downloaded the NoSqlWorkbench and I can connect to my database without any problems, list the items for the indices etc but when I try a basic PartiQL question, the error returned is the same as when using the lambda

In NoSQLWorkbench I have tried a few different queries, this being the simplest one I could think of:
select * from habits_sensors-playground

and I also tried what I think should get the data using the index such as:
select * from habits_sensors-playground.userId-gsi where userId='user1'

where habits_sensors-playground is the name of the table.

but like calling from the lambda, it returns the same "Unexpected from source" error.

I do see all my items listed in the NoSQLWorkbench so everything is working fine but I must be missing something with how to use PartiQL?

Crossposting from https://stackoverflow.com/questions/65888399/dynamodb-partiql-select-query-returns-validationexception-unexpected-from-sourc since I did not get any suggestions there.

All suggestions welcome, I must be missing something very basic.

Edited by: hubbobubbo on Jan 26, 2021 2:55 AM

Edited by: hubbobubbo on Jan 26, 2021 2:58 AM

Edited by: hubbobubbo on Jan 26, 2021 2:59 AM

gefragt vor 3 Jahren3272 Aufrufe
2 Antworten
0

In testing, I've found that table names which include a dash must be quoted. For example:

SELECT * FROM "habits_sensors-playground";

SELECT * FROM "habits_sensors-playground"."userId-gsi" WHERE userId='user1';

Thank you for raising the question - I had not encountered this exception before.

beantwortet vor 3 Jahren
0

Thank you Pete, that did the trick. Not easy to spot, I did try single quotes but not the double ones.

The dash comes from amplify appending the env name to the table so I guess it can happen to others as well.

beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen