1

I am running the following query in the AWS DynamoDB PartiQL editor:

SELECT DISTINCT column1
FROM "my_lucky-table" 
WHERE Id = "db05-5d1"

but I am getting the following error:

ValidationException: Unsupported token in expression: DISTINCT

Any idea how to deal with this? If DINSTICT is not supported in PartiQL what else can I run in order to get the unique values from column1 ?? Thank you.

Telis
  • 311
  • 1
  • 9

1 Answers1

1

PartiQL does not support Distinct. I'm not sure what data type your column1 is but for the most part you would need to do the distinct filtering on your client side not on the DynamoDB side.

Leeroy Hannigan
  • 11,409
  • 3
  • 14
  • 31
  • Is there any indirect way to get the unique values from a column in PartiQL? Or we are doomed? – Telis Nov 18 '22 at 07:00
  • 1
    Doomed I'm afraid. I'm guessing you mean unique across all items? There is no such thing as a column in DynamoDB, having that mindset is leading you to believe something like this can be achieved. You must think of DynamoDB as schemaless where each item acts alone. – Leeroy Hannigan Nov 18 '22 at 09:22
  • Not doomed lol You can create a secondary index that lets you do that using the right composite key. Sorry, almost a year later :( – Bennybear Aug 18 '23 at 15:45