-
Notifications
You must be signed in to change notification settings - Fork 2
Multi line prepared statement #1
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
Comments
I personally use a query builder like knex for more dynamic queries, like an const knex = require('knex')
exports.insertUsers = function (users) {
const sqlString = knex('users')
.insert(users.map((u) => ({ uname: u.uname })))
.toString()
return client._query(sqlString)
} I should update the README to provide examples like this. Notice that, in pg-extra, |
That is awesome. Thanks! |
Updated the readme with this example. This is the same thing you'd do whether you use pg-extra or the underlying |
Uh oh!
There was an error while loading. Please reload this page.
Appreciate your work on this repo.
Working on my first koa/vuejs/node/postgres project so apologies if this is a silly question. I have large bulk inserts to perform. ie:
INSERT INTO
foo (col1,col2,col3)
VALUES
(1,2,3),
(4,5,6),
(7,8,9),
......
I'm not sure how to build out very long sql statements. I've attempted something like brianc/node-postgres#530 (comment) but I get an error that client.query expects either sql or __raw within client.query.
Could you suggest a way to build out the query? Could be many many lines long. Cheers.
The text was updated successfully, but these errors were encountered: