Skip to content

Commit

Permalink
fix: spanner_cofig get logic and error when not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
DataBoyTX committed Jan 25, 2025
1 parent 52e9b4b commit 1104969
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions graphistry/PlotterBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -2530,13 +2530,14 @@ def spanner_gql_to_g(self: Plottable, query: str) -> Plottable:
res = copy.copy(self)

if not hasattr(res, '_spannergraph'):
spanner_config = PyGraphistry._config["spanner"]
spanner_config = PyGraphistry._config.get("spanner", None)

if spanner_config is not None:
logger.debug(f"Spanner Config: {spanner_config}")
else:
raise ValueError('spanner_config is None, use spanner_init() or register() passing spanner_config')
raise ValueError('spanner_config not defined. Pass spanner_config via register() and retry query.')

res = res.spanner_init(PyGraphistry._config["spanner"]) # type: ignore[attr-defined]
res = res.spanner_init(spanner_config) # type: ignore[attr-defined]

return res._spannergraph.gql_to_graph(res, query)

Expand Down

0 comments on commit 1104969

Please sign in to comment.