Save Changes to bulk update a table with primary key

Hi there,

I have a large table that will be frequently updated with new values by users. Ideally, they edit values inside of the columns and then submit the changes with the Save Changes button.

Right now, I have a statement like

update table 
set quantity = {{table1.recordUpdates[1].quantity}}
where id IN ({{table1.recordUpdates[1].id}})

The above works, but it only works for a single record. I'd like to put in a variable so that it can update as many rows as are edited by the users. Not sure how to set this up.

Thanks for any and all help!

Use the GUI instead it's a lot easier to set up
https://docs.retool.com/docs/adding-a-new-row-to-your-database-or-api#creating-a-bulk-update-query

Thanks. This grabs the correct record I want to update. However, I get this error:

Parameter types must be provided for null values via the 'types' field in query options.

My guess is because some of the column values for that row are null, but I'd like to keep it that way if possible. There are a lot of different possible things users will edit and I'd like to let them edit as much or as little as possible.

Hi Shu!

Happy to help you here!

Would love to see these queries in their entirety here to get a better idea of how to approach this here.

Hey, sorry never got back to this. ScottR's solution ended up working. I was previously using a couple different columns within the table to act as a primary key, but I ended up adding a primary key to the table and using the GUI, which has worked great!

Additionally, we started using Postgres over BigQuery and it's also been a large improvement.