From 52e9b4b1c330a65b5ddbba4e4aa7a383ed400697 Mon Sep 17 00:00:00 2001 From: Thomas Cook Date: Fri, 24 Jan 2025 12:28:33 -0600 Subject: [PATCH 1/3] fix: credential_file logic when not defined --- graphistry/plugins/spannergraph.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) From 1104969f2f4f98df179628fbe7a008e9336f41b7 Mon Sep 17 00:00:00 2001 From: Thomas Cook Date: Fri, 24 Jan 2025 18:35:48 -0600 Subject: [PATCH 2/3] fix: spanner_cofig get logic and error when not defined --- graphistry/PlotterBase.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) From e3e7e628153e684f86b7ed76f4e4a1f554762857 Mon Sep 17 00:00:00 2001 From: Thomas Cook Date: Fri, 24 Jan 2025 19:15:14 -0600 Subject: [PATCH 3/3] chore: update to v0.35.10 in CHANGELOG.md w/ comments --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) 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