diff --git a/CHANGELOG.md b/CHANGELOG.md index f52dc720f2..e24dc4d93c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Development] +## [0.35.10 - 2025-01-24] + +### Fixes: + +* Spanner: better handling of spanner_config issues: #634, #644 + ## [0.35.9 - 2025-01-22] ### Docs diff --git a/graphistry/PlotterBase.py b/graphistry/PlotterBase.py index f4ed0917a3..885acfc8aa 100644 --- a/graphistry/PlotterBase.py +++ b/graphistry/PlotterBase.py @@ -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) diff --git a/graphistry/plugins/spannergraph.py b/graphistry/plugins/spannergraph.py index 7f29dbbf5c..3aeb6a34a1 100644 --- a/graphistry/plugins/spannergraph.py +++ b/graphistry/plugins/spannergraph.py @@ -82,7 +82,8 @@ def __connect(self) -> Any: from google.cloud.spanner_dbapi.connection import connect try: - if self.credentials_file: + if hasattr(self, 'credentials_file') and self.credentials_file is not None: + connection = connect(self.instance_id, self.database_id, credentials=self.credentials_file) else: connection = connect(self.instance_id, self.database_id)