Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support syntax helper for "bulk insert with parameters" #147

Open
mattrobenolt opened this issue Nov 13, 2023 · 0 comments
Open

feat: Support syntax helper for "bulk insert with parameters" #147

mattrobenolt opened this issue Nov 13, 2023 · 0 comments

Comments

@mattrobenolt
Copy link
Member

mattrobenolt commented Nov 13, 2023

A pattern that is a bit of a pain for us is doing an INSERT with multiple rows at once.

While we support explicitly doing something like:

execute("INSERT INTO x VALUES (?, ?, ?), (?, ?, ?)", [1, 2, 3, 4, 5, 6])

It puts the burden on the user to create all of the (?, ?, ?) placeholders.

An API similar to:

bulkinsert("INSERT INTO x VALUES", [[1, 2, 3], [4, 5, 6]])

would help utilize this without the client needing to construct all of the placeholders.

We could even just provide this as a separate function that's passed into execute() as just a "query builder" thing.

So something like:

execute(createBulkInsert("INSERT INTO x VALUES", [[1, 2, 3], [4, 5, 6]]))

And createBulkInsert would return the SQL.

It's just all around a bit awkward to need to have one big flat list of all the parameters vs passing in more logical "rows".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant