Tuesday 22 October 2019

Postgres, upsert, transactions, and KnexJS

Hope this is the right place to ask this.I'm working on a project using Node and Postgres, with Knex serving as the query builder. Knex has been working great so far but I'm realizing it doesn't easily support any ON CONFLICT statements. My system has to replace existing data with new incoming information quite often, so this is a bit of a problem.I've found some workarounds for the lack of upsert functionality (namely using knex.raw()) but I have hesitations regarding the security of this, as well how to format it for use within a transaction.Is it possible to do this with Knex? Would a different Node query builder accommodate my needs better? Thanks for any input.

Submitted October 22, 2019 at 09:30PM by MindBodyLightSound

No comments:

Post a Comment