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

feat(graph): Flexible Schema Extension to SpannerGraphStore #125

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mtyin
Copy link
Collaborator

@mtyin mtyin commented Jan 3, 2025

feat(graph): Extension to SpannerGraphStore

Many use cases don't have a clean pre-specified schema, hence this change adds support to generic flexible graph schema.

  1. Allow a dynamic schema for nodes and edges:
  • both nodes and edges are stored in one table with dynamic label and properties (JSON)
  1. Allow more than one (src.node.id, target.node.id, edge.type) by introducing a uuid as part of the key;
  2. Prefix the table names with graph names to avoid conflicting.
  3. Add json type support.

Fixes #<issue_number_goes_here> 🦕

- Allow a dynamic schema for nodes and edges:
  - nodes are stored in one table with dynamic label and properties (JSON)
- Allow more than one (src.node.id, target.node.id, edge.type) by
  introducing a uuid as part of the key;
- Prefix the table names with graph names to avoid conflicting.
@mtyin mtyin requested review from a team as code owners January 3, 2025 18:01
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/langchain-google-spanner-python API. label Jan 3, 2025
@mtyin mtyin changed the title feat(grah): Extension to SpannerGraphStore feat(graph): Extension to SpannerGraphStore Jan 3, 2025
@mtyin mtyin changed the title feat(graph): Extension to SpannerGraphStore feat(graph): Flexible Schema Extension to SpannerGraphStore Jan 3, 2025
Copy link
Collaborator

@amullick-git amullick-git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

mtyin and others added 2 commits January 21, 2025 17:56
Previously, we override all columns by schema;
with this change, we selectively write specified columns.

Note:
- this won't change the behavior if you always do a full blind write;
src/langchain_google_spanner/graph_store.py Outdated Show resolved Hide resolved
docs/graph_store.ipynb Show resolved Hide resolved
docs/graph_store.ipynb Outdated Show resolved Hide resolved
docs/graph_store.ipynb Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/langchain-google-spanner-python API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants