22
33image:https://github.com/nmervaillie/neo4j-db-copy/actions/workflows/ci.yml/badge.svg["CI", link="https://github.com/nmervaillie/neo4j-db-copy/actions/workflows/ci.yml"]
44
5- A development tool useful to copy the data from a Neo4j database to another Neo4j database.
5+ A development tool useful to copy the data from a Neo4j database to another Neo4j database, or to and from a JSONL file .
66Databases can be local or remote.
7- As the copy is done through the Neo4j driver, no admin access to Neo4j is required.
7+ As the copy is done through the Neo4j driver or a local JSONL export , no admin access to Neo4j is required.
88
99This is useful to copy things around, for example test/reference data from an environment to another.
1010
@@ -24,15 +24,15 @@ The resulting app can be found in the `target` directory.
2424
2525[source,bash]
2626----
27- Usage: neo4j-db-copy [-hV] [-lock] -sp -tp - sa=<sourceAddress>
28- -sd=<sourceDatabase> [-su=<sourceUserName>]
29- -ta=<targetAddress> -td=<targetDatabase>
27+ Usage: neo4j-db-copy [-hV] [-lock] -sa=<sourceAddress>
28+ [ -sd=<sourceDatabase>] [-sp] [-su=<sourceUserName>]
29+ -ta=<targetAddress> [ -td=<targetDatabase>] [-tp]
3030 [-tu=<targetUserName>] [-enp=<excludeNodeProperties>[,
3131 <excludeNodeProperties>...]]...
3232 [-erp=<excludeRelationshipProperties>[,
3333 <excludeRelationshipProperties>...]]...
34- Copy the content of a Neo4j database to another Neo4j database, via the
35- network, through the bolt protocol .
34+ Copy the content of a Neo4j database to another Neo4j database, or to/from a
35+ JSONL file .
3636 -enp, --exclude-node-properties=<excludeNodeProperties>[,
3737 <excludeNodeProperties>...]
3838 Comma-separated list of node properties to exclude from the
@@ -44,22 +44,62 @@ network, through the bolt protocol.
4444 -h, --help Show this help message and exit.
4545 -lock, --lock-source-database
4646 Set the source database to read-only mode before copying
47+ (only valid for bolt/neo4j source)
4748 -sa, --source-address=<sourceAddress>
48- The source database address (ex: neo4j+s://my-server:7687)
49+ The source address: bolt/neo4j URI for Neo4j, or
50+ file:///path/to/file.jsonl for JSONL
4951 -sd, --source-database=<sourceDatabase>
50- The source database to connect to.
52+ The source database to connect to (used only for bolt/neo4j
53+ URIs).
5154 -sp, --source-password
52- The source database password to connect with
55+ The source database password to connect with (used only for
56+ bolt/neo4j URIs)
5357 -su, --source-username=<sourceUserName>
54- The source database username to connect as (default: neo4j)
58+ The source database username to connect as (default: neo4j,
59+ used only for bolt/neo4j URIs)
5560 -ta, --target-address=<targetAddress>
56- The target database address (ex: neo4j+s://my-server:7687)
61+ The target address: bolt/neo4j URI for Neo4j, or
62+ file:///path/to/file.jsonl for JSONL
5763 -td, --target-database=<targetDatabase>
58- The target database to connect to.
64+ The target database to connect to (used only for bolt/neo4j
65+ URIs).
5966 -tp, --target-password
60- The target database password to connect with
67+ The target database password to connect with (used only for
68+ bolt/neo4j URIs)
6169 -tu, --target-username=<targetUserName>
62- The target database username to connect as (default: neo4j)
70+ The target database username to connect as (default: neo4j,
71+ used only for bolt/neo4j URIs)
6372 -V, --version Print version information and exit.
6473----
6574
75+ Bolt credentials and database names are required only for bolt/neo4j endpoints.
76+ `file:` endpoints are local JSONL files and do not use Neo4j credentials.
77+
78+ The JSON export format is JSONL: one JSON object per line.
79+ Files ending in `.gz` are read and written as gzip-compressed JSONL.
80+ Only `file:` URIs are supported for JSON import/export.
81+
82+ Examples:
83+
84+ [source,bash]
85+ ----
86+ # Neo4j -> Neo4j
87+ neo4j-db-copy \
88+ -sa neo4j+s://source.example:7687 -su neo4j -sp -sd sourcedb \
89+ -ta neo4j+s://target.example:7687 -tu neo4j -tp -td targetdb
90+
91+ # Neo4j -> JSONL
92+ neo4j-db-copy \
93+ -sa neo4j+s://source.example:7687 -su neo4j -sp -sd sourcedb \
94+ -ta file:///tmp/export.jsonl
95+
96+ # Neo4j -> compressed JSONL
97+ neo4j-db-copy \
98+ -sa neo4j+s://source.example:7687 -su neo4j -sp -sd sourcedb \
99+ -ta file:///tmp/export.jsonl.gz
100+
101+ # compressed JSONL -> Neo4j
102+ neo4j-db-copy \
103+ -sa file:///tmp/export.jsonl.gz \
104+ -ta neo4j+s://target.example:7687 -tu neo4j -tp -td targetdb
105+ ----
0 commit comments