Neo4j
Neo4j 源连接器
描述
Neo4j 源连接器通过执行 Cypher 查询从 Neo4j 读取数据,并把查询返回字段映射成 SeaTunnel 表结构。
neo4j-java-driver 版本:4.4.9
主要特性
数据类型映射
| Neo4j 值类型 | SeaTunnel 数据类型 |
|---|---|
| String | STRING |
| Boolean | BOOLEAN |
| Integer | INT / BIGINT |
| Float | FLOAT / DOUBLE |
| ByteArray | BYTES |
| Date | DATE |
| LocalTime | TIME |
| LocalDateTime | TIMESTAMP |
| List | ARRAY |
| Map | MAP |
| Null | NULL |
源选项
| 名称 | 类型 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|---|
| uri | String | 是 | - | Neo4j 连接地址,例如 neo4j://localhost:7687 或 bolt://localhost:7687。 |
| username | String | 否 | - | Neo4j 用户名,需要和 password 一起使用。username、bearer_token、kerberos_ticket 三种认证方式至少配置一种。 |
| password | String | 否 | - | Neo4j 密码。配置 username 时必须配置。 |
| bearer_token | String | 否 | - | 用于 Neo4j 认证的 bearer token。 |
| kerberos_ticket | String | 否 | - | 用于 Neo4j 认证的 Kerberos ticket。 |
| database | String | 是 | - | Neo4j 数据库名。 |
| query | String | 是 | - | 读取数据使用的 Cypher 查询语句。查询返回字段必须和 schema.fields 对应。 |
| schema | Object | 是 | - | 查询结果对应的 SeaTunnel 表结构,在 schema.fields 中配置字段名和类型。 |
| max_transaction_retry_time | Long | 否 | 30 | 最大事务重试时间,单位为秒。 |
| max_connection_timeout | Long | 否 | 30 | 建立 TCP 连接的最大等待时间,单位为秒。 |
注意事项
- 认证方式只选一种:用户名密码、bearer token 或 Kerberos ticket。
query决定返回哪些字段,schema.fields必须写清这些返回字段和对应类型。- 查询返回字段名可以包含点号,例如从节点属性返回的
t.string。 MAP字段的 key 必须是STRING,例如MAP<STRING, INT>。- Neo4j 的整数和浮点数会按
schema.fields中声明的 SeaTunnel 类型转换;如果数值可能超过INT或FLOAT范围,建议使用BIGINT或DOUBLE。
任务示例
env {
parallelism = 1
job.mode = "BATCH"
}
source {
Neo4j {
uri = "neo4j://localhost:7687"
username = "neo4j"
password = "password"
database = "neo4j"
max_transaction_retry_time = 1
max_connection_timeout = 1
query = "MATCH (t:Test) WITH *, t{.int} AS _map RETURN t.string, t.boolean, t.long, t.double, t.byteArray, t.date, t.localDateTime, _map, t.list, t.int, t.float"
schema {
fields {
t.string = STRING
t.boolean = BOOLEAN
t.long = BIGINT
t.double = DOUBLE
t.null = NULL
t.byteArray = BYTES
t.date = DATE
t.localDateTime = TIMESTAMP
_map = "MAP<STRING, INT>"
t.list = "ARRAY<INT>"
t.int = INT
t.float = FLOAT
}
}
}
}
sink {
Console {}
}
变更日志
Change Log
| Change | Commit | Version |
|---|---|---|
| [improve] neo4j options (#9164) | https://github.com/apache/seatunnel/commit/1eb81e7f88 | 2.3.11 |
| [Improve] restruct connector common options (#8634) | https://github.com/apache/seatunnel/commit/f3499a6eeb | 2.3.10 |
| [Feature][Restapi] Allow metrics information to be associated to logical plan nodes (#7786) | https://github.com/apache/seatunnel/commit/6b7c53d03c | 2.3.9 |
| [Feature][Doris] Add Doris type converter (#6354) | https://github.com/apache/seatunnel/commit/5189991843 | 2.3.6 |
| [Feature][Core] Upgrade flink source translation (#5100) | https://github.com/apache/seatunnel/commit/5aabb14a94 | 2.3.4 |
| [Improve][Common] Introduce new error define rule (#5793) | https://github.com/apache/seatunnel/commit/9d1b2582b2 | 2.3.4 |
[Improve] Remove use SeaTunnelSink::getConsumedType method and mark it as deprecated (#5755) | https://github.com/apache/seatunnel/commit/8de7408100 | 2.3.4 |
| Support config column/primaryKey/constraintKey in schema (#5564) | https://github.com/apache/seatunnel/commit/eac76b4e50 | 2.3.4 |
| [Improve] Documentation and partial word optimization. (#4936) | https://github.com/apache/seatunnel/commit/6e8de0e2a6 | 2.3.3 |
| [Improve][connector-V2-Neo4j]Supports neo4j sink batch write and update docs (#4841) | https://github.com/apache/seatunnel/commit/580276a8bd | 2.3.3 |
| Merge branch 'dev' into merge/cdc | https://github.com/apache/seatunnel/commit/4324ee1912 | 2.3.1 |
| [Improve][Project] Code format with spotless plugin. | https://github.com/apache/seatunnel/commit/423b583038 | 2.3.1 |
| [improve][api] Refactoring schema parse (#4157) | https://github.com/apache/seatunnel/commit/b2f573a13e | 2.3.1 |
| [Improve][build] Give the maven module a human readable name (#4114) | https://github.com/apache/seatunnel/commit/d7cd601051 | 2.3.1 |
| [Improve][Project] Code format with spotless plugin. (#4101) | https://github.com/apache/seatunnel/commit/a2ab166561 | 2.3.1 |
| [Feature][Connector] add get source method to all source connector (#3846) | https://github.com/apache/seatunnel/commit/417178fb84 | 2.3.1 |
| [Feature][API & Connector & Doc] add parallelism and column projection interface (#3829) | https://github.com/apache/seatunnel/commit/b9164b8ba1 | 2.3.1 |
| [Hotfix][OptionRule] Fix option rule about all connectors (#3592) | https://github.com/apache/seatunnel/commit/226dc6a119 | 2.3.0 |
| [Improve][Connector-V2][Neo4j] Unified exception for Neo4j source & sink connector (#3565) | https://github.com/apache/seatunnel/commit/58584eefb1 | 2.3.0 |
| [Feature][Connector][Neo4j] expose configurable options in Neo4j (#3342) | https://github.com/apache/seatunnel/commit/efa04b38fe | 2.3.0 |
| [Connector-V2][ElasticSearch] Add ElasticSearch Source/Sink Factory (#3325) | https://github.com/apache/seatunnel/commit/38254e3f26 | 2.3.0 |
| [Feature][Connector-v2] Neo4j source connector (#2777) | https://github.com/apache/seatunnel/commit/38b0daf8b7 | 2.3.0 |
| [#2606]Dependency management split (#2630) | https://github.com/apache/seatunnel/commit/fc047be69b | 2.2.0-beta |
| [Feature][Connector-v2] Neo4j sink connector (#2434) | https://github.com/apache/seatunnel/commit/950b27d132 | 2.2.0-beta |