postgres-meta
postgres-meta copied to clipboard
Support batch `POST` (for columns for starters)
Feature request
Is your feature request related to a problem? Please describe.
Creating a table with multiple columns is pretty slow. Supporting batch POST
would save us a couple round trips and remedy that.
Describe the solution you'd like
Make POST
accept a list of objects in addition to a single object. e.g.:
POST /columns
[
{ "table_id": 123456, "name": "c1", "type": "text" },
{ "table_id": 123456, "name": "c2", "type": "text" }
]
@soedirgo I'd like to take a crack at it.
I understand that we need to support both object and array of objects in POST
body of /columns
, let me know if there anything else i need to be aware before starting.
Go for it @mahendraHegde!
we need to support both object and array of objects in POST body of /columns
Yup, ideally we also do the batch create in one db query, so we might also need to modify PostgresMetaColumns
in lib
(instead of just the server
)
@soedirgo yes makes sense i will modify the PostgresMetaColumns.create
to accept the array and return array. How ever i have a doubt,
since each object of the array will have table_id
, so should we assume every row for the same table or are we supposed to support multiple table alter as well?
@soedirgo i have made the changes for single table batch update, since its my 1st contribution to this repo plz give your feedback, i will add & fix tests meanwhile.