pg-copy-streams
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -5,2 +5,3 @@ 'use strict' | ||
const CopyFromQueryStream = require('./copy-from') | ||
const CopyBothQueryStream = require('./copy-both') | ||
module.exports = { | ||
@@ -13,2 +14,5 @@ to: function (txt, options) { | ||
}, | ||
both: function (txt, options) { | ||
return new CopyBothQueryStream(txt, options) | ||
}, | ||
} |
{ | ||
"name": "pg-copy-streams", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Low-Level COPY TO and COPY FROM streams for PostgreSQL in JavaScript using", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,3 +9,3 @@ ## pg-copy-streams | ||
Did you know the _all powerful_ PostgreSQL supports streaming binary data directly into and out of a table? | ||
Did you know that PostgreSQL supports streaming binary data directly into and out of a table? | ||
This means you can take your favorite CSV or TSV or whatever format file and pipe it directly into an existing PostgreSQL table. | ||
@@ -17,7 +17,7 @@ You can also take a table and pipe it directly to a file, another database, stdout, even to `/dev/null` if you're crazy! | ||
If you're not familiar with the feature (I wasn't either) you can read this for some good helps: http://www.postgresql.org/docs/9.3/static/sql-copy.html | ||
If you're not familiar with the feature (I wasn't either) you can read this for some good helps: http://www.postgresql.org/docs/9.6/static/sql-copy.html | ||
## examples | ||
### pipe from a table to stdout | ||
### pipe from a table to stdout (copyOut - copy-to) | ||
@@ -40,3 +40,3 @@ ```js | ||
### pipe from a file to table | ||
### pipe from a file to table (copyIn - copy-from) | ||
@@ -62,2 +62,10 @@ ```js | ||
### duplex stream for replication / logical decoding scenarios (copyBoth - copy-both) | ||
This is a more advanded topic. | ||
Check the test/copy-both.js file for an example of how this can be used. | ||
_Note regarding logical decoding_: Parsers for logical decoding scenarios are easier to write when copy-both.js pushes chunks that are aligned on the copyData protocol frames. This is not the default mode of operation of copy-both.js in order to increase the streaming performance. If you need the pushed chunks to be alignes on copyData frames, use the `alignOnCopyDataFrame: true` option. | ||
## install | ||
@@ -95,2 +103,14 @@ | ||
Since version 5.1.0 and the implementation of copy-both.js for logical decoding scenarios, your local postgres instance will need to be configured to accept replication scenarios : | ||
``` | ||
postgresq.conf | ||
wal_level = logical | ||
max_wal_senders > 0 | ||
max_replication_slots > 0 | ||
pg_hba.conf | ||
make sure your user can connect using the replication mode | ||
``` | ||
```sh | ||
@@ -115,4 +135,8 @@ $ PGPORT=5432 PGDATABASE=postgres make test | ||
### version 4.x - not yet published | ||
### version 5.1.0 - published 2020-06-07 | ||
This version adds a Duplex stream implementation of the PostgreSQL copyBoth mode described on https://www.postgresql.org/docs/9.6/protocol-flow.html. This mode opens the possibility of dealing with replication and logical decoding scenarios. | ||
- implement copy-both.js | ||
### version 5.0.0 - published 2020-05-14 | ||
@@ -119,0 +143,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31867
9
542
232