Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS: Cypher25 apoc proc func migration docs #4209

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@

This chapter lists all the features that have been removed, deprecated, added or extended in the recent versions of APOC.

[[apoc-deprecations-additions-removals-2025.01]]
== Version 2025.01

=== New procedures and functions

[cols="2", options="header"]
|===
| Feature
| Details

a|
label:procedure[]
label:new[]
[source, cypher, role="noheader"]
----
apoc.export.arrow.all(file [, config ])
apoc.export.arrow.graph(file, graph [, config ])
apoc.export.arrow.query(file, query [, config ])
apoc.export.arrow.stream.all([ config ])
apoc.export.arrow.stream.graph(graph [, config ])
apoc.export.arrow.stream.query(query [, config ])
apoc.load.arrow(file [, config ])
apoc.load.arrow.stream(source [, config ])
apoc.load.jsonParams(urlOrKeyOrBinary, headers, payload [, path, config ])
apoc.log.stream(path [, config ])
----
a|
All of these procedures were migrated from Cypher Core.

|===

[[apoc-deprecations-additions-removals-5.0]]
== Version 5.0

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
:page-role: procedure
:table-caption!:
= apoc.export.arrow.all

[NOTE]
====
This procedure is not considered safe to run from multiple threads.
It is therefore not supported by the parallel runtime (introduced in Neo4j 5.13).
For more information, see the link:{neo4j-docs-base-uri}/cypher-manual/{page-version}/planning-and-tuning/runtimes/concepts#runtimes-parallel-runtime[Cypher Manual -> Parallel runtime].
====

.Details
|===
| *Syntax* 3+| `apoc.export.arrow.all(file [, config ]) :: (file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data)`
| *Description* 3+| Exports the full database as an arrow file.
.3+| *Input arguments* | *Name* | *Type* | *Description*
| `file` | `STRING` | The name of the file to export the data to.
| `config` | `MAP` | `{ batchSize = 2000 :: INTEGER }`. The default is: `{}`.
.13+| *Return arguments* | *Name* | *Type* | *Description*
| `file` | `STRING` | The name of the file to which the data was exported.
| `source` | `STRING` | A summary of the exported data.
| `format` | `STRING` | The format the file is exported in.
| `nodes` | `INTEGER` | The number of exported nodes.
| `relationships` | `INTEGER` | The number of exported relationships.
| `properties` | `INTEGER` | The number of exported properties.
| `time` | `INTEGER` | The duration of the export.
| `rows` | `INTEGER` | The number of rows returned.
| `batchSize` | `INTEGER` | The size of the batches the export was run in.
| `batches` | `INTEGER` | The number of batches the export was run in.
| `done` | `BOOLEAN` | Whether the export ran successfully.
| `data` | `ANY` | The data returned by the export.
|===

== Usage Examples
The procedure expose an Arrow file with the following structure
- `<id>`: for node id
- `<labels>`: list of labels
- `<source.id>`: source node id (in case of relationship)
- `<target.id>`: target node id (in case of relationship)
- `<type>`: for relationship type
- the list of properties of nodes and relationships flattened as table

So for the following query:

[source,cypher]
----
CREATE (f:User {name:'Adam',age:42,male:true,kids:['Sam','Anna','Grace'], born:localdatetime('2015185T19:32:24'), place:point({latitude: 13.1, longitude: 33.46789})})-[:KNOWS {since: 1993, bffSince: duration('P5M1.5D')}]->(b:User {name:'Jim',age:42}),(c:User {age:12}),(d:Another {foo: 'bar'})
----

With this query:

[source,cypher]
----
CALL apoc.export.arrow.all('my_file.arrow') YIELD file, source, format,
nodes, relationships, properties,
time, rows, batchSize,
batches, done, data
----

We'll have an arrow file with the following columns:

- `<id>`
- `<labels>`
- `<source.id>`
- `<target.id>`
- `<type>`
- `name`
- `age`
- `male`
- `kids`
- `born`
- `place`
- `since`
- `bffSince`
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
:page-role: procedure
:table-caption!:
= apoc.export.arrow.graph

[NOTE]
====
This procedure is not considered safe to run from multiple threads.
It is therefore not supported by the parallel runtime (introduced in Neo4j 5.13).
For more information, see the link:{neo4j-docs-base-uri}/cypher-manual/{page-version}/planning-and-tuning/runtimes/concepts#runtimes-parallel-runtime[Cypher Manual -> Parallel runtime].
====

.Details
|===
| *Syntax* 3+| `apoc.export.arrow.graph(file, graph [, config ]) :: (file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data)`
| *Description* 3+| Exports the given graph as an arrow file.
.4+| *Input arguments* | *Name* | *Type* | *Description*
| `file` | `STRING` | The name of the file to export the data to.
| `graph` | `ANY` | The graph to export.
| `config` | `MAP` | `{ batchSize = 2000 :: INTEGER }`. The default is: `{}`.
.13+| *Return arguments* | *Name* | *Type* | *Description*
| `file` | `STRING` | The name of the file to which the data was exported.
| `source` | `STRING` | A summary of the exported data.
| `format` | `STRING` | The format the file is exported in.
| `nodes` | `INTEGER` | The number of exported nodes.
| `relationships` | `INTEGER` | The number of exported relationships.
| `properties` | `INTEGER` | The number of exported properties.
| `time` | `INTEGER` | The duration of the export.
| `rows` | `INTEGER` | The number of rows returned.
| `batchSize` | `INTEGER` | The size of the batches the export was run in.
| `batches` | `INTEGER` | The number of batches the export was run in.
| `done` | `BOOLEAN` | Whether the export ran successfully.
| `data` | `ANY` | The data returned by the export.
|===

== Usage Examples
The procedure expose an Arrow file of rows with the following structure
- `<id>`: for node id
- `<labels>`: list of labels
- `<source.id>`: source node id (in case of relationship)
- `<target.id>`: target node id (in case of relationship)
- `<type>`: for relationship type
- the list of properties of nodes and relationships flattened as table

So for the following query:

[source,cypher]
----
CREATE (f:User {name:'Adam',age:42,male:true,kids:['Sam','Anna','Grace'], born:localdatetime('2015185T19:32:24'), place:point({latitude: 13.1, longitude: 33.46789})})-[:KNOWS {since: 1993, bffSince: duration('P5M1.5D')}]->(b:User {name:'Jim',age:42}),(c:User {age:12}),(d:Another {foo: 'bar'})
----

With this query:

[source,cypher]
----
CALL apoc.graph.fromDB('neo4j',{}) yield graph
CALL apoc.export.arrow.graph('my_file.arrow', graph) YIELD file, source, format,
nodes, relationships, properties,
time, rows, batchSize,
batches, done, data
----

We'll have an arrow file with the following columns:

- `<id>`
- `<labels>`
- `<source.id>`
- `<target.id>`
- `<type>`
- `name`
- `age`
- `male`
- `kids`
- `born`
- `place`
- `since`
- `bffSince`
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:page-role: procedure
:table-caption!:
= apoc.export.arrow.query

[NOTE]
====
This procedure is not considered safe to run from multiple threads.
It is therefore not supported by the parallel runtime (introduced in Neo4j 5.13).
For more information, see the link:{neo4j-docs-base-uri}/cypher-manual/{page-version}/planning-and-tuning/runtimes/concepts#runtimes-parallel-runtime[Cypher Manual -> Parallel runtime].
====

.Details
|===
| *Syntax* 3+| `apoc.export.arrow.query(file, query [, config ]) :: (file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data)`
| *Description* 3+| Exports the results from the given Cypher query as an arrow file.
.4+| *Input arguments* | *Name* | *Type* | *Description*
| `file` | `STRING` | The name of the file to which the data will be exported.
| `query` | `STRING` | The query to use to collect the data for export.
| `config` | `MAP` | `{ batchSize = 2000 :: INTEGER }`. The default is: `{}`.
.13+| *Return arguments* | *Name* | *Type* | *Description*
| `file` | `STRING` | The name of the file to which the data was exported.
| `source` | `STRING` | A summary of the exported data.
| `format` | `STRING` | The format the file is exported in.
| `nodes` | `INTEGER` | The number of exported nodes.
| `relationships` | `INTEGER` | The number of exported relationships.
| `properties` | `INTEGER` | The number of exported properties.
| `time` | `INTEGER` | The duration of the export.
| `rows` | `INTEGER` | The number of rows returned.
| `batchSize` | `INTEGER` | The size of the batches the export was run in.
| `batches` | `INTEGER` | The number of batches the export was run in.
| `done` | `BOOLEAN` | Whether the export ran successfully.
| `data` | `ANY` | The data returned by the export.
|===

== Usage Examples
Let's suppose we have this data set:

[source,cypher]
----
CREATE (f:User {name:'Adam',age:42,male:true,kids:['Sam','Anna','Grace'], born:localdatetime('2015185T19:32:24'), place:point({latitude: 13.1, longitude: 33.46789})})-[:KNOWS {since: 1993, bffSince: duration('P5M1.5D')}]->(b:User {name:'Jim',age:42}),(c:User {name: 'John', age:12}),(d:Another {foo: 'bar'})
----

With this query:

[source,cypher]
----
CALL apoc.export.arrow.query('my_file.arrow', 'MATCH (n:User) RETURN count(n) as count, n.name as name') YIELD file, source, format,
nodes, relationships, properties,
time, rows, batchSize,
batches, done, data
----

We'll have an arrow file with the following columns:

- `count`
- `name`
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
:page-role: procedure
:table-caption!:
= apoc.export.arrow.stream.all

[NOTE]
====
This procedure is not considered safe to run from multiple threads.
It is therefore not supported by the parallel runtime (introduced in Neo4j 5.13).
For more information, see the link:{neo4j-docs-base-uri}/cypher-manual/{page-version}/planning-and-tuning/runtimes/concepts#runtimes-parallel-runtime[Cypher Manual -> Parallel runtime].
====

.Details
|===
| *Syntax* 3+| `apoc.export.arrow.stream.all([ config ]) :: (value)`
| *Description* 3+| Exports the full database as an arrow byte array.
.2+| *Input arguments* | *Name* | *Type* | *Description*
| `config` | `MAP` | `{ batchSize = 2000 :: INTEGER }`. The default is: `{}`.
.2+| *Return arguments* | *Name* | *Type* | *Description*
| `value` | `BYTEARRAY` | The data as a bytearray.
|===

== Usage Examples
The procedure expose an Arrow byte[] for each batch of rows with the following structure
- `<id>`: for node id
- `<labels>`: list of labels
- `<source.id>`: source node id (in case of relationship)
- `<target.id>`: target node id (in case of relationship)
- `<type>`: for relationship type
- the list of properties of nodes and relationships flattened as table

So for the following query:

[source,cypher]
----
CREATE (f:User {name:'Adam',age:42,male:true,kids:['Sam','Anna','Grace'], born:localdatetime('2015185T19:32:24'), place:point({latitude: 13.1, longitude: 33.46789})})-[:KNOWS {since: 1993, bffSince: duration('P5M1.5D')}]->(b:User {name:'Jim',age:42}),(c:User {age:12}),(d:Another {foo: 'bar'})
----

With this query:

[source,cypher]
----
CALL apoc.export.arrow.stream.all()
----

We'll have a table with the following columns:

- `<id>`
- `<labels>`
- `<source.id>`
- `<target.id>`
- `<type>`
- `name`
- `age`
- `male`
- `kids`
- `born`
- `place`
- `since`
- `bffSince`
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
:page-role: procedure
:table-caption!:
= apoc.export.arrow.stream.graph

[NOTE]
====
This procedure is not considered safe to run from multiple threads.
It is therefore not supported by the parallel runtime (introduced in Neo4j 5.13).
For more information, see the link:{neo4j-docs-base-uri}/cypher-manual/{page-version}/planning-and-tuning/runtimes/concepts#runtimes-parallel-runtime[Cypher Manual -> Parallel runtime].
====

.Details
|===
| *Syntax* 3+| `apoc.export.arrow.stream.graph(graph [, config ]) :: (value)`
| *Description* 3+| Exports the given graph as an arrow byte array.
.3+| *Input arguments* | *Name* | *Type* | *Description*
| `graph` | `ANY` | The graph to export.
| `config` | `MAP` | `{ batchSize = 2000 :: INTEGER }`. The default is: `{}`.
.2+| *Return arguments* | *Name* | *Type* | *Description*
| `value` | `BYTEARRAY` | The data as a bytearray.
|===

== Usage Examples
The procedure expose an Arrow byte[] for each batch of rows with the following structure
- `<id>`: for node id
- `<labels>`: list of labels
- `<source.id>`: source node id (in case of relationship)
- `<target.id>`: target node id (in case of relationship)
- `<type>`: for relationship type
- the list of properties of nodes and relationships flattened as table

So for the following query:

[source,cypher]
----
CREATE (f:User {name:'Adam',age:42,male:true,kids:['Sam','Anna','Grace'], born:localdatetime('2015185T19:32:24'), place:point({latitude: 13.1, longitude: 33.46789})})-[:KNOWS {since: 1993, bffSince: duration('P5M1.5D')}]->(b:User {name:'Jim',age:42}),(c:User {age:12}),(d:Another {foo: 'bar'})
----

With this query:

[source,cypher]
----
CALL apoc.graph.fromDB('neo4j',{}) yield graph
CALL apoc.export.arrow.stream.graph(graph)
YIELD value RETURN value"
----

We'll have a table with the following columns:

- `<id>`
- `<labels>`
- `<source.id>`
- `<target.id>`
- `<type>`
- `name`
- `age`
- `male`
- `kids`
- `born`
- `place`
- `since`
- `bffSince`
Loading
Loading