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

[WIP] Proof of concept for view-backed verticies and edges #1735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jberzy
Copy link
Contributor

@jberzy jberzy commented Apr 8, 2024

Hello,

This is a minimal POC for vertices and edges backed by views. I'm new to contributing to this repo, and there is still a lot to do, so thought I'd get feedback early in case this is not such a good idea...

There are a few use cases for this feature that come to mind:

  • Creating labels backed by other data sources without explicitly loading the data into the graph
  • Pre-computing complex queries in materialized views but still have a uniform way to query that data
  • Ad-hoc categorization of multiple labels
  • Filtered labels
  • Labels derived from FDWs?

here is a little example that works so far:

CREATE EXTENSION age;
LOAD 'age';
SET search_path = ag_catalog, "$user", public;

SELECT create_graph('graphdb');

SELECT * FROM cypher('graphdb', $$
CREATE (:Person {name: 'Daedalus'})-[:FATHER_OF]->(:Person {name: 'Icarus'})
$$) AS (a agtype);

CREATE VIEW graphdb.filtered_person as
    SELECT p.* from graphdb."Person" p
	Where p.properties ->> 'name'::text = 'Daedalus'

SELECT create_computed_vlabel('graphdb', 'FilteredPerson', 'filtered_person');

SELECT * FROM cypher('graphdb', $$
match (a:FilteredPerson)
return a
$$) AS (a agtype);

There was really not that many changes to get the above working. But quite a bit more needs to get done such as validating the view's schema, error messages when attempting to write, handling dropping computed label, testing, etc.

It would be great to get some feedback about this idea in general.

Thanks,
John

@github-actions github-actions bot added the master label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant