-
Notifications
You must be signed in to change notification settings - Fork 209
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
add support for google spanner graph #622
base: master
Are you sure you want to change the base?
Conversation
from typing import Any | ||
from google.cloud.spanner_dbapi.connection import connect | ||
from google.cloud.spanner_v1.data_types import JsonObject | ||
from google.cloud.spanner_v1 import KeySet |
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.
this can be an optional dep in setup.py:
Line 48 in 7f5b2db
base_extras_light = { |
moving to dynamic imports may help, not sure
@@ -0,0 +1,287 @@ | |||
import os |
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.
graphistry/plugins - https://github.com/graphistry/pygraphistry/tree/master/graphistry/plugins
@@ -38,6 +38,7 @@ | |||
from .arrow_uploader import ArrowUploader | |||
from .nodexlistry import NodeXLGraphistry | |||
from .tigeristry import Tigeristry | |||
from .database_clients.spannergraph import spannergraph |
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.
this top-level import would force all users to import, so we need to be lazy/dynamic somewhere
get_schema: Retrieve the schema of the database. | ||
validate_data: Validate input data for queries or updates. | ||
dump_config: Returns the configuration of the spannergraph instance. | ||
""" |
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.
see the docs conventions in more modern code in pygraphistry, this is important for sphinx/readthedocs . likewise, for llm use, important to have examples in the doc strs
Returns: | ||
PlotterBase: A PlotterBase instance configured with SpannerGraph. | ||
""" | ||
return Plotter().spannergraph(project_id, instance_id, database_id) |
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.
re:interface --
Connection
i wonder if we want something similar to the bolt connectors, where we can do streamlined auth + passing in a client
CONN_CFG = { ... }
g1 = graphistry.spanner_connect(**CONN_CFG)
g2 = g1.spanner_query("...")
native_client = google.spanner.client(...)
g1 = graphistry.spanner_connect(native_client)
g2 = g1.spanner_query("....")
Return-typed query methods
Separately, a pattern I'm finding to be type-friendly with remote-mode gfql has been separating return-shape-typed methods:
g2 = g1.spanner_g("get a graph")
df = g1.spanner_df("get a table"")
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.
Also, in the neo4j & gremlin cases, when building real examples:
- hydration: I found scenarios like we'd get either node IDs or edge IDs and would want to then hydrate them against the db
- stored procedures: does GSQL have some notion of passing inputs
- reads vs creates vs writes: any notions here? a good flow would be an example of going through uploading some data, querying it, doing some local enrichment, and then writing back the updates
Part of this makes me want to have some bigger examples to motivate helper functions on top. I suspect query_g()
and query_df()
can be good starts, but we need these examples to make more realistic
(The lack of bulk reads/writes such as via arrow is a bit puzzling, but that can wait?)
TODO(tcook)