Skip to content

Commit 25131b2

Browse files
authored
[NOID] Fixes #4244: Make apoc.dv.* procedures work in clusters (#4281) (#4324)
* [NOID] Fixes #4244: Make apoc.dv.* procedures work in clusters (#4281)
1 parent 89037fe commit 25131b2

15 files changed

+1102
-678
lines changed

docs/asciidoc/modules/ROOT/pages/overview/apoc.dv/apoc.dv.catalog.add.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This file is generated by DocsTest, so don't change it!
55
= apoc.dv.catalog.add
66
:description: This section contains reference documentation for the apoc.dv.catalog.add procedure.
77

8-
label:procedure[] label:apoc-full[]
8+
label:procedure[] label:apoc-full[] label:deprecated[]
99

1010
[.emphasis]
1111
Add a virtualized resource configuration
@@ -17,6 +17,8 @@ Add a virtualized resource configuration
1717
apoc.dv.catalog.add(name :: STRING?, config = {} :: MAP?) :: (name :: STRING?, type :: STRING?, url :: STRING?, desc :: STRING?, labels :: LIST? OF STRING?, query :: STRING?, params :: LIST? OF STRING?)
1818
----
1919

20+
include::partial$/dv/deprecated.adoc[]
21+
2022
[WARNING]
2123
====
2224
This procedure is not intended to be used in a cluster environment, and may act unpredictably.

docs/asciidoc/modules/ROOT/pages/overview/apoc.dv/apoc.dv.catalog.list.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This file is generated by DocsTest, so don't change it!
55
= apoc.dv.catalog.list
66
:description: This section contains reference documentation for the apoc.dv.catalog.list procedure.
77

8-
label:procedure[] label:apoc-full[]
8+
label:procedure[] label:apoc-full[] label:deprecated[]
99

1010
[.emphasis]
1111
List all virtualized resource configuration
@@ -17,6 +17,8 @@ List all virtualized resource configuration
1717
apoc.dv.catalog.list() :: (name :: STRING?, type :: STRING?, url :: STRING?, desc :: STRING?, labels :: LIST? OF STRING?, query :: STRING?, params :: LIST? OF STRING?)
1818
----
1919

20+
include::partial$/dv/deprecated.adoc[]
21+
2022
== Output parameters
2123
[.procedures, opts=header]
2224
|===

docs/asciidoc/modules/ROOT/pages/overview/apoc.dv/apoc.dv.catalog.remove.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This file is generated by DocsTest, so don't change it!
55
= apoc.dv.catalog.remove
66
:description: This section contains reference documentation for the apoc.dv.catalog.remove procedure.
77

8-
label:procedure[] label:apoc-full[]
8+
label:procedure[] label:apoc-full[] label:deprecated[]
99

1010
[.emphasis]
1111
Remove a virtualized resource config by name
@@ -17,6 +17,8 @@ Remove a virtualized resource config by name
1717
apoc.dv.catalog.remove(name :: STRING?) :: (name :: STRING?, type :: STRING?, url :: STRING?, desc :: STRING?, labels :: LIST? OF STRING?, query :: STRING?, params :: LIST? OF STRING?)
1818
----
1919

20+
include::partial$/dv/deprecated.adoc[]
21+
2022
[WARNING]
2123
====
2224
This procedure is not intended to be used in a cluster environment, and may act unpredictably.

docs/asciidoc/modules/ROOT/pages/virtual-resource/index.adoc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
= Virtual Resource
33
:description: This chapter describes how to handle external data sources as virtual resource without persisting them in the database
44

5+
include::partial$systemdbonly.note.adoc[]
6+
57
[NOTE]
68
====
79
There are situations where we would like to enrich/complement the results of a cypher query in a Neo4j graph with additional
@@ -40,10 +42,11 @@ image::apoc.dv.imported-graph-from-RDB.png[scaledwidth="100%"]
4042
== Managing a Virtualized Resource via JDBC
4143

4244
=== Creating a Virtualized Resource (JDBC)
43-
Before we can query a Virtualized Resource, we need to define it. We do this using the `apoc.dv.catalog.add` procedure.
44-
The procedure takes two parameters:
45+
Before we can query a Virtualized Resource, we need to define it. We do this using the `apoc.dv.catalog.install` procedure.
46+
The procedure takes three parameters:
4547

4648
* a name that uniquely identifies the virtualized resource and can be used to query that resource
49+
* the database name where we want to use the resource (default is `'neo4j'`)
4750
* a set of parameters indicating the type of the resource (type), the access point (url), the parameterised query
4851
that will be run on the access point (query) and the labels that will be applied to the generated virtual nodes (labels).
4952

@@ -56,7 +59,7 @@ Here is the cypher that creates such virtualized resource:
5659

5760
[source,cypher]
5861
----
59-
CALL apoc.dv.catalog.add("fr-towns-by-dept", {
62+
CALL apoc.dv.catalog.install("fr-towns-by-dept", "neo4j", {
6063
type: "JDBC",
6164
url: "jdbc:postgresql://localhost/communes?user=jb&password=jb",
6265
labels: ["Town","PopulatedPlace"],
@@ -124,19 +127,19 @@ RETURN path
124127
----
125128

126129
=== Listing the Virtualized Resource Catalog
127-
The apoc.dv.catalog.list procedure returns a list with all the existing Virtualized resources and their descriptions. It takes no parameters.
130+
The apoc.dv.catalog.list procedure returns a list with all the existing Virtualized resources and their descriptions. It accepts one parameter: i.e. the database name where we want to use the resource (default is 'neo4j').
128131

129132
[source,cypher]
130133
----
131-
CALL apoc.dv.catalog.list()
134+
CALL apoc.dv.catalog.show()
132135
----
133136

134137
=== Removing Virtualized Resources from the Catalog
135138
When a Virtualized Resource is no longer needed it can be removed from the catalog by using the apoc.dv.catalog.remove procedure passing as parameter the unique name of the VR.
136139

137140
[source,cypher]
138141
----
139-
CALL apoc.dv.catalog.remove("vr-name")
142+
CALL apoc.dv.catalog.drop("vr-name", <dbName>)
140143
----
141144

142145
=== Export metadata
@@ -165,7 +168,7 @@ Here is the cypher that creates such virtualized resource:
165168

166169
[source,cypher]
167170
----
168-
CALL apoc.dv.catalog.add("prod-details-by-id", {
171+
CALL apoc.dv.catalog.install("prod-details-by-id", "neo4j", {
169172
type: "CSV",
170173
url: "http://data.neo4j.com/northwind/products.csv",
171174
labels: ["ProductDetails"],
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[WARNING]
2+
====
3+
Please note that this procedure is deprecated.
4+
5+
Use the following ones instead, which allow for better support in a cluster:
6+
7+
[opts="header"]
8+
|===
9+
| deprecated procedure | new procedure
10+
| `apoc.dv.catalog.add(<name>, $config)` | `apoc.dv.catalog.install('<name>', '<dbName>', $config)`
11+
| `apoc.dv.catalog.remove('<name>')` | `apoc.dv.catalog.drop('<name>', '<dbName>')`
12+
| `apoc.dv.catalog.list()` | `apoc.dv.catalog.show('<dbName>')`
13+
|===
14+
15+
where `<dbName>` is the database where we want to execute the procedure
16+
17+
xref::virtual-resource/index.adoc[See here for more info].
18+
19+
====

full-it/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ dependencies {
1111
testImplementation project(':core').sourceSets.test.output
1212
testImplementation project(':full').sourceSets.test.output
1313

14+
testImplementation group: 'us.fatehi', name: 'schemacrawler-mysql', version: '16.20.8'
15+
1416
testImplementation group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.12.770'
1517
testImplementation group: 'org.xmlunit', name: 'xmlunit-core', version: '2.9.1'
1618

0 commit comments

Comments
 (0)