-
Notifications
You must be signed in to change notification settings - Fork 495
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
Fixes #3610: Add advanced SQL analytics to streaming cypher rows before returning results to the client #4339
base: dev
Are you sure you want to change the base?
Conversation
…re returning results to the client
|
||
You can use the `apoc.jdbc.analytics(<cypherQuery>, <jdbcUrl>, <sqlQueryOverTemporaryTable>, <paramsList>, $config)` | ||
to create a temporary table starting from a Cypher query | ||
and delegate complex analytics to the database defined JDBC URL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defined by the JDBC URL
ORDER BY rank, country, name;", | ||
$params, | ||
{ provider: "POSTGRES" }) | ||
---- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add a full example using an in-memory DuckDb to perform analytics
private String mapSqlType(Provider provider, Object value) { | ||
return switch (provider) { | ||
case MYSQL, POSTGRES -> { | ||
if (value instanceof Number) yield "INTEGER"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the Number is a Float?
Fixes #3610
Overview
Fixes
https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/3610
Created an
apoc.jdbc.analytics(<cypherQuery>, <jdbcUrl>, <sqlQueryOverTemporaryTable>, <paramsList>, $config)
procedure.Imho is better than use an aggregation function, because it's more customizable, since I can choose what results to get and how to get them, otherwise to do something like below, with movies_count I should put e.g. a parameter
aggKeys
and increase the complexity.The procedure executes 3 steps:
<cypherQuery>
param<sqlQuery>
param (which can be an complex analytics query) and returns dataChanges implemented
apoc.load.jdbc*
for DuckDB inextended/src/test/java/apoc/load/DuckDBJdbcTest.java
jdbc:duckdb:
URL. Therefore added fallback here to allow it.apoc.load.jdbc.analytics
tests for:EDIT: Changes after review
time
in MySQLapoc.load.jdbc
packageTo evaluate