Comments (4)
Can I use submit(connection)
for this?
from node-pg-copy-streams.
This works, however, not too elegant...
from node-pg-copy-streams.
The problem you have here is that the COPY operation is atomic in the sense that the data is sent to the database on-the-fly, but not visible until the end of the COPY operation.
you cannot send interim commits that would "commit" the changes every 1000 rows.
your solution in the gist creates many 1000-lines COPY operations. Every time 1 COPY operation finishes, the 1000 added rows are immediatly visible. I cannot say if it is the most elegant way of doing it, there are probably other solutions.
The current API does not handle such a multi-COPY abstraction.
Can I ask what is your use case exactly and why one COPY is not enough ?
from node-pg-copy-streams.
At this stage, there is no plan to integrate a batch mode inside this module. I can understand the use case but there is no way to to interim commits on a COPY so the only solution I can think of is the one you mentioned in your example : several calls to COPY.
from node-pg-copy-streams.
Related Issues (20)
- COPY errors result in hangs or delayed exceptions HOT 3
- copy-from performance with lots of chunks HOT 15
- Question: is it possible to get the line number of the file where copy failed? HOT 5
- copyFrom stream's end function does not behave as expected HOT 6
- Cannot execute multiple COPY commands within the same transaction HOT 2
- Error: Release called on client which has already been released to the pool. HOT 2
- copy-from fails when large csv file(200K+ user rows) is copied from the file to the DB HOT 17
- Very different times on table with keys vs table without keys HOT 5
- `COPY FROM` fails when upgrading from v6.0.1 to v6.0.2+ HOT 43
- Documentation doesn't work with latest `pg` HOT 6
- Idle connections with "COMMIT" HOT 2
- Something seems wrong with binary transfer for COPY ... FROM STDIN BINARY HOT 8
- Not really an issue... HOT 1
- client.query is not returning a stream HOT 10
- Row count always off by one on CopyToStreamQuery HOT 8
- Copying data failing but no error triggered HOT 23
- help needed: concurrent requests HOT 6
- copyFrom: TypeError: this.cb_ReadyForQuery is not a function HOT 5
- COPY TO with query_timeout
- Parametrizing COPY ... TO STDOUT query HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-pg-copy-streams.