Skip to content

Commit 105487b

Browse files
authored
Fix spanner creds issues: fixes: #634, #644 (#646)
* fix: credential_file logic when not defined * fix: spanner_cofig get logic and error when not defined * chore: update to v0.35.10 in CHANGELOG.md w/ comments
1 parent 3d4c986 commit 105487b

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
77

88
## [Development]
99

10+
## [0.35.10 - 2025-01-24]
11+
12+
### Fixes:
13+
14+
* Spanner: better handling of spanner_config issues: #634, #644
15+
1016
## [0.35.9 - 2025-01-22]
1117

1218
### Docs

graphistry/PlotterBase.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,13 +2530,14 @@ def spanner_gql_to_g(self: Plottable, query: str) -> Plottable:
25302530
res = copy.copy(self)
25312531

25322532
if not hasattr(res, '_spannergraph'):
2533-
spanner_config = PyGraphistry._config["spanner"]
2533+
spanner_config = PyGraphistry._config.get("spanner", None)
2534+
25342535
if spanner_config is not None:
25352536
logger.debug(f"Spanner Config: {spanner_config}")
25362537
else:
2537-
raise ValueError('spanner_config is None, use spanner_init() or register() passing spanner_config')
2538+
raise ValueError('spanner_config not defined. Pass spanner_config via register() and retry query.')
25382539

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

25412542
return res._spannergraph.gql_to_graph(res, query)
25422543

graphistry/plugins/spannergraph.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ def __connect(self) -> Any:
8282
from google.cloud.spanner_dbapi.connection import connect
8383

8484
try:
85-
if self.credentials_file:
85+
if hasattr(self, 'credentials_file') and self.credentials_file is not None:
86+
8687
connection = connect(self.instance_id, self.database_id, credentials=self.credentials_file)
8788
else:
8889
connection = connect(self.instance_id, self.database_id)

0 commit comments

Comments
 (0)