1

I'm attempting to send a batch of PartiQL statements in the NodeJS AWS SDK v3. The statement works fine for a single ExecuteStatementCommand, but the Batch command doesn't.

The statement looks like

const statement = `
SELECT *
FROM "my-table"
WHERE "partitionKey" = '1234'
  AND "filterKey" = '5678'
`

This code snippet works as expected:

const result = await dynamodbClient.send(new ExecuteStatementCommand(
  { Statement: statement}
))

The batch snippet does not:

const result = await dynamodbClient.send(new BatchExecuteStatementCommand({
  Statements: [
    {
      Statement: statement
    }
  ]
}))

The batch call produces the following error:

"Code": "ValidationError",
"Message": "Select statements within BatchExecuteStatement must specify the primary key in the where clause."

Any insight is greatly appreciated. Thanks for taking the time to reading my question!

1 Answers1

1

Seems like what I needed was a rubber duck.

DynamoDB primary keys consists of partition key + sort key. My particular table has a sort key, which is missing from the statement. Batch jobs cannot handle filtering of responses, and each statement must match a single item in the database.