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

Fixes #3610: Add advanced SQL analytics to streaming cypher rows before returning results to the client #4339

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

vga91
Copy link
Collaborator

@vga91 vga91 commented Jan 24, 2025

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.

            MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
            RETURN 
                p.name AS actor, 
                m.genre AS genre, 
                r.roles AS roles, 
                COUNT(m) AS movies_count

The procedure executes 3 steps:

  1. creates a temporary table
  2. populates the table starting from the <cypherQuery> param
  3. queries the table with the <sqlQuery> param (which can be an complex analytics query) and returns data

Changes implemented

To evaluate

  • (maybe in a different PR/Issue): Improve handling: some SQL databases like Microsoft SQL Server create temp table in a different way
  • config getOrDefault "temp_table", "tableName"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant