vertica / vertica-nodejs

Official native node.js client for the Vertica Analytics Database.
https://www.vertica.com/
Apache License 2.0
12 stars 14 forks source link

Batch insert #104

Closed negreanucalin closed 1 year ago

negreanucalin commented 1 year ago

Hello I am trying to do batch inserts and took this as an example, just thought that this library implemented batching.

In short I need to 20-30 inserts at once and tried to run this (is a test to insert 5 entries) query object:

{
    name: 'buildInsertBatch',
    text: 'INSERT INTO call (id, caller, calling) VALUES (?, ?, ?)',
    values: [
        [call.getCallId(), call.getCallId(), call.getCallId(), call.getCallId(), call.getCallId()],
        [call.getCaller(), call.getCaller(), call.getCaller(), call.getCaller(), call.getCaller()],
        [call.getCalling(),call.getCalling(), call.getCalling(), call.getCalling(), call.getCalling()]
    ]
}

But I get the following error: INSERT has more expressions than target columns

Is there any way to achieve with this library?

negreanucalin commented 1 year ago

Figured out I can use vertica's syntax:

INSERT INTO calls (call_id,other) values ('1.0', 'other0'),('1.0', 'other1'),('1.0', 'other2'),('1.0', 'other3')