2

I'm using the RDSDataService.batchExecuteStatement to update records in a postgres database. I'm struggling with understanding how the query parameter should be formatted for an update query.

The insert query is very straight forward and the documentation shows this formatted as

insert into mytable values (:id, :val)

With a full request looking like

aws rds-data batch-execute-statement --resource-arn "arn:aws:rds:us-east-1:123456789012:cluster:mydbcluster" \
--database "mydb" --secret-arn "arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret" \
--sql "insert into mytable values (:id, :val)" \
--parameter-sets "[[{\"name\": \"id\", \"value\": {\"longValue\": 1}},{\"name\": \"val\", \"value\": {\"stringValue\": \"ValueOne\"}}],
[{\"name\": \"id\", \"value\": {\"longValue\": 2}},{\"name\": \"val\", \"value\": {\"stringValue\": \"ValueTwo\"}}],
[{\"name\": \"id\", \"value\": {\"longValue\": 3}},{\"name\": \"val\", \"value\": {\"stringValue\": \"ValueThree\"}}]]"

How would an update query look like? Would it just be the following?

update mytable set :id, set :val

TemporaryFix
  • 1,435
  • 1
  • 23
  • 47

0 Answers0