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

Describe property graph #115

Merged
merged 12 commits into from
Apr 3, 2024
Merged

Describe property graph #115

merged 12 commits into from
Apr 3, 2024

Conversation

Dtenwolde
Copy link
Contributor

@Dtenwolde Dtenwolde commented Mar 28, 2024

Fixes #114

It is now possible to do DESCRIBE PROPERTY GRAPH <pg_name> which shows you details of a property graph you have previously created.
For example:

import database 'duckdb-pgq/data/SNB0.003'; 

-CREATE OR REPLACE PROPERTY GRAPH snb
  VERTEX TABLES (
      Person LABEL Person,
      Organisation LABEL Organisation IN typemask(company, university)
      )
  EDGE TABLES (
      Person_knows_person     SOURCE KEY (Person1Id) REFERENCES Person (id)
                              DESTINATION KEY (Person2Id) REFERENCES Person (id)
                              LABEL Knows
      );

Will be described as follows:

-DESCRIBE PROPERTY GRAPH snb;

┌─────────────────────┬──────────────┬─────────────────┬──────────────┬───────────┬─────────────┬───────────────────┬────────────────┬────────────────┬───────────────┬───────────────────────┐
│     table_name      │    label     │ is_vertex_table │ source_table │ source_pk │  source_fk  │ destination_table │ destination_pk │ destination_fk │ discriminator │      sub_labels       │
│       varcharvarcharbooleanvarcharvarchar[] │  varchar[]  │      varcharvarchar[]    │   varchar[]    │    varcharvarchar[]       │
├─────────────────────┼──────────────┼─────────────────┼──────────────┼───────────┼─────────────┼───────────────────┼────────────────┼────────────────┼───────────────┼───────────────────────┤
│ Organisation        │ organisation │ true            │              │           │             │                   │                │                │ typemask      │ [company, university] │
│ Person              │ person       │ true            │              │           │             │                   │                │                │               │                       │
│ Person_knows_person │ knows        │ false           │ Person       │ [id]      │ [Person1Id] │ Person            │ [id]           │ [Person2Id]    │               │                       │
└─────────────────────┴──────────────┴─────────────────┴──────────────┴───────────┴─────────────┴───────────────────┴────────────────┴────────────────┴───────────────┴───────────────────────┘

If the property graph does not exist, an error is thrown.

@Dtenwolde Dtenwolde added the needs documentation Improvements or additions to documentation label Mar 28, 2024
@Dtenwolde Dtenwolde merged commit 205b231 into main Apr 3, 2024
16 of 24 checks passed
@Dtenwolde Dtenwolde deleted the 114-describe-property-graph branch April 3, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Describe property graph
1 participant