Skip to content

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

@mattrobenolt

Description

@mattrobenolt

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".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions