You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add product recommendation sql script (former TPC-H) and add couple of messages for better error understanding
Co-authored-by: Martin Junghanns <martin.junghanns@neo4j.com>
@@ -97,24 +97,24 @@ FROM snowflake_sample_data.tpch_sf1.lineitem l;
97
97
USE DATABASE Neo4j_GDS;
98
98
99
99
-- Next, we want to consider the warehouse that the GDS application will use to execute queries.
100
-
-- For this examplea MEDIUMsize warehouse, so we configure the application's warehouse accordingly
100
+
-- For this example, we use a MEDIUM-size warehouse, so we configure the application's warehouse accordingly
101
101
ALTER WAREHOUSE Neo4j_GDS_app_warehouse SET WAREHOUSE_SIZE='MEDIUM';
102
+
GRANT USAGE ON WAREHOUSE Neo4j_GDS_app_warehouse TO APPLICATION Neo4j_GDS;
102
103
-- A highly performant warehouse can speed up graph projections but does not affect algorithm computation.
103
104
-- Especially if the views are more complex than shown in this example, a more performant warehouse is beneficial.
104
105
-- The warehouse can then be brought back to a less expensive configuration after the projection is done.
105
-
-- ALTER WAREHOUSE Neo4j_GDS_app_warehouse
106
-
-- WAREHOUSE_SIZE='X-SMALL';
106
+
-- ALTER WAREHOUSE Neo4j_GDS_app_warehouse WAREHOUSE_SIZE='X-SMALL';
107
107
108
108
-- The following grants are necessary for the GDS application to read and write data.
109
109
-- The next queries are required to read from our prepared views.
110
-
GRANT USAGE ON DATABASE tpch_example TO APPLICATION Neo4j_GDS;
111
-
GRANT USAGE ON SCHEMA tpch_example.gds TO APPLICATION Neo4j_GDS;
112
-
GRANTSELECTON ALL VIEWS IN SCHEMA tpch_example.gds TO APPLICATION Neo4j_GDS;
110
+
GRANT USAGE ON DATABASE product_recommendation TO APPLICATION Neo4j_GDS;
111
+
GRANT USAGE ON SCHEMA product_recommendation.gds TO APPLICATION Neo4j_GDS;
112
+
GRANTSELECTON ALL VIEWS IN SCHEMA product_recommendation.gds TO APPLICATION Neo4j_GDS;
113
113
-- This grant is necessary to enable write back of algorithm results.
114
-
GRANT CREATE TABLE ON SCHEMA tpch_example.gds TO APPLICATION Neo4j_GDS;
114
+
GRANT CREATE TABLE ON SCHEMA product_recommendation.gds TO APPLICATION Neo4j_GDS;
115
115
116
116
-- We have now prepared the environment to properly run the GDS application and can start with our analysis.
117
-
-- Note, that data preparation and application setup only need to be done once.
117
+
-- Note that data preparation and application setup only need to be done once.
118
118
119
119
-- Our final preparation is to select a compute pool to run the GDS service.
120
120
-- Available compute pools to select from are:
@@ -124,82 +124,60 @@ GRANT CREATE TABLE ON SCHEMA tpch_example.gds TO APPLICATION Neo4j_GDS;
124
124
-- * HIGHMEM_X64_S
125
125
-- * HIGHMEM_X64_M
126
126
-- * HIGHMEM_X64_L
127
-
-- * GPU_NV_S
128
-
--
127
+
-- * GPU_NV_S - available for GPU-required algorithms only
128
+
129
129
-- For our example, we use a large compute pool as the node similarity algorithm is computationally intensive, but without extra memory because the graph is quite small.
-- Tables 'parts' and 'orders' are used as node tables, table name will be treated as a node label.
145
+
'nodeTables': ['parts', 'orders'],
146
+
'relationshipTables': {
147
+
-- The 'part_in_order' table is used as a relationship table, and the sourceNodeId and targetNodeId
148
+
-- columns are specified and contain the node IDs from the correspond node tables.
149
+
-- The relationship table name will be treated as a relationship type.
150
+
'part_in_order': {
151
+
'sourceTable': 'parts',
152
+
'targetTable': 'orders',
153
+
'orientation': 'NATURAL'
154
+
}
159
155
}
160
156
},
161
-
'readConcurrency': 28
162
-
});
163
-
164
-
-- The graph we project is a so-called bipartite graph, as it contains two types of nodes and all relationships point from one type to the other.
165
-
-- The node similarity algorithm looks at all pairs of nodes of the first type and calculates the similarity for each pair based on common relationships.
166
-
-- In our case, the algorithm will calculate the similarity between two parts based on the orders in which they appear.
167
-
-- The algorithm produces new relationships between parts, the relationship property is the similarity score.
168
-
-- For further information on the node similarity algorithm, please refer to the GDS documentation:
0 commit comments