Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

429
Views
With DynamoDB and docClient, Is it possible to get return values when using transactWrite?

Let's say I am doing an update and a delete:

const transactionParams = {
    ReturnConsumedCapacity: "INDEXES",
    TransactItems: [
      {
        Delete: {
          TableName: reactionTableName,
          Key: {
            "SOME_PK_",
            "SOME_SK_",
          },
          ReturnValues: 'ALL_OLD',
        },
      },
      {
        Update: {
          TableName: reviewTableName,
          Key: { PK: "SOME_PK", SK: "SOME_SK" },
          ReturnValues: 'ALL_OLD',
        },
      },
    ],
  };

  try {
    const result = await docClient.transactWrite(transactionParams).promise();
  } catch (error) {
    context.done(error, null);
  }

even thoughI am using ReturnValues as "ALL_OLD" I can't seem to get access to that. Is this possible with transactWrite, or am I required to do a get after and eat up a read?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Have you checked out ItemCollectionMetrics in the response? The docs suggest its a map of table name -> items affected by the query

https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html#API_TransactWriteItems_ResponseElements

over 4 years ago · Santiago Trujillo Report

0

await docClient.transactWrite(transactWriteItemsQueryParam, (err, data) => {
        if (err) {
          console.error('Transaction Failed. Error JSON:', JSON.stringify(err, null, 2));
          reject(err);
        } else {
          console.log('Transaction succeeded:', JSON.stringify(data, null, 2));
            //data[0].Items -is result of delete query
            //data[1].Items -is result of update query
          resolve(data);
        }
      });
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!