You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
There are 2 methods for authenticating with Spanner:
gcp service account credentials file, and
web-based interactive authentication
a new optional parameter was added to register() to allow passing in spanner config:
spanner_config dict must contain the include the following keys, credentials_file is optional:
- "project_id": The GCP project ID.
- "instance_id": The Spanner instance ID.
- "database_id": The Spanner database ID.
- "credentials_file": json file API key for service accounts
if using method #2 (web-based interactive auth) which does not require credentials_file, spanner_init errors with:
SpannerConnectionError: Failed to connect to Spanner: 'SpannerGraph' object has no attribute 'credentials_file'
To Reproduce
use option 2, which does not require credentials_file to be set, then attempt to call
importpandasaspdimportgraphistryPROJECT_ID="my_project"INSTANCE_ID="my_instance"DATABASE_ID="finance-graph-db"# google settings, option 1: interactive login using gcloud auth application-default login (below)SPANNER_CONF= { "project_id": PROJECT_ID,
"instance_id": INSTANCE_ID,
"database_id": DATABASE_ID }
graphistry.register(api=3, personal_key_id='xxx', personal_key_secret='xxx', server='hub.graphistry.com', spanner_config=SPANNER_CONF)
# google auth stuff: # Set the google project id
!gcloudconfigsetproject {PROJECT_ID}
%envGOOGLE_CLOUD_PROJECT={PROJECT_ID}
# web-based interactive login to GCP:
!gcloudauthapplication-defaultlogin# spanner graph query: query=f'''GRAPH FinGraphMATCH p = (a)-[b]->(c) where 1=1 {LIMIT_CLAUSE} return SAFE_TO_JSON(p) as path'''g=graphistry.spanner_gql_to_g(query)
Expected behavior
should not error out as credentials_file is not required with web-based auth
Actual behavior
AttributeError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/graphistry/plugins/spannergraph.py in __connect(self)
84 try:
---> 85 if self.credentials_file:
86 connection = connect(self.instance_id, self.database_id, credentials=self.credentials_file)
AttributeError: 'SpannerGraph' object has no attribute 'credentials_file'
During handling of the above exception, another exception occurred:
SpannerConnectionError Traceback (most recent call last)
5 frames
/usr/local/lib/python3.11/dist-packages/graphistry/plugins/spannergraph.py in __connect(self)
92 return connection
93 except Exception as e:
---> 94 raise SpannerConnectionError(f"Failed to connect to Spanner: {e}")
95
96 def close_connection(self) -> None:
SpannerConnectionError: Failed to connect to Spanner: 'SpannerGraph' object has no attribute 'credentials_file'
The text was updated successfully, but these errors were encountered:
Describe the bug
There are 2 methods for authenticating with Spanner:
a new optional parameter was added to register() to allow passing in spanner config:
if using method #2 (web-based interactive auth) which does not require credentials_file, spanner_init errors with:
To Reproduce
use option 2, which does not require
credentials_file
to be set, then attempt to callExpected behavior
should not error out as
credentials_file
is not required with web-based authActual behavior
The text was updated successfully, but these errors were encountered: