Neo4j configurations¶
This topic introduces the configuration options for importing data from a Neo4j data source. For information about the complete configuration file and options, see Data import configurations.
Data source configurations¶
The following table lists the configuration options specific to the Neo4j data source.
| Option | Description | Type | Required | Default value |
|---|---|---|---|---|
type |
The type of the data source. In this case, set the value to "neo4j". |
String | Yes | N/A |
server |
The address and port of the Neo4j server using the bolt protocol. | String | Yes | N/A |
user |
The username of the Neo4j server. | String | Yes | N/A |
password |
The password of the user. | String | Yes | N/A |
database |
The name of the database from which data is retrieved. | String | No | N/A |
encryption |
Whether encryption is enabled for the connection. | Bool | No | false |
statement |
The Cypher statement used to retrieve data from Neo4j. | String | Yes | N/A |
queryCount |
A Cypher statement that returns a count field or a specific number, used to represent the number of records returned by statement. |
Object | Yes | N/A |
readParallel |
The number of concurrent read requests that are allowed. | Int | No | 32 |
Common source configurations¶
The following configuration options can also be specified as global settings in the section sourcesCommon of the configuration file:
typeserveruserpassworddatabaseencryptionreadParallel
Note that the configurations on specific data sources override the global settings.
Data source configuration example¶
Neo4j source configurations
sources: [
{
type:"neo4j"
server: "bolt://127.0.0.1:7687"
user: neo4j
password: neo4j
database: default
encryption: false
statement: "match (v:movie) return v.id as id, v.name as name"
queryCount: "match (v:movie) return count(*) as count"
// queryCount: 1000
readParallel: 32
// nodetypes: []
// edgetypes: []
}
]
Complete configuration example¶
Replace <current-password> with the current password for the specified account. If the password has changed, use the new password.
{
taskType: import
nebula: {
graphAddr: "127.0.0.1:9669"
graphName: "movie"
user: "root"
passwd: "<current-password>"
}
error: {
path: "/tmp/errors"
maxRecords: 10000
}
checkPoint: {
path: "/tmp/checkpoint"
resume: false
}
sourcesCommon:{
type:"neo4j"
server: "bolt://127.0.0.1:7687"
user: neo4j
password: neo4j
readParallel: 32
}
writeCommon:{
batchSize: 2000
enableRealTimeQPSLog: true
mode: "INSERT IGNORE"
}
sources: [
# node type Actor
{
statement:"match (v:actor) return v.id as people_id, v.name as name, v.birth_date as birth_date"
queryCount: "match (v:actor) return count(*) as count"
pre_processes: {
filter: ["birth_date!='\\N'"]
concatConstant: [
{
field: "name"
prefixValue: "test_"
suffixValue: ""
}
]
}
nodetypes: [
{
name: "Actor"
sourceFields: [people_id,name,birth_date]
nebulaFields: [id,name,birthDate]
}
]
}
# node type Movie
{
statement:"match (v:movie) return v.id as movie_id, v.name as name"
queryCount: "match (v:movie) return count(*) as count"
nodetypes: [
{
name: "Movie"
sourceFields: [movie_id,name]
nebulaFields: [id,name]
}
]
}
# edge type Act
{
statement:"match (v1)-[e:act]->(v2) return e.src as people_id, e.dst as movie_id"
queryCount: "match (v1)-[e:act]->(v2) return count(*) as count"
edgetypes: [
{
name: "Act"
sourceKeys: [people_id]
nebulaSrcKeys: [id]
targetKeys: [movie_id]
nebulaDstKeys: [id]
sourceFields: []
nebulaFields: []
}
]
}
]
}