Skip to content

[BUG] spanner queries give KeyError if spanner_config not set via register() #644

@DataBoyTX

Description

@DataBoyTX

Describe the bug

if spanner_config not set, spanner_gql_to_g and likely spanner_query_to_df errors out. Need to handle better with error message on how to resolve vs python KeyError

To Reproduce

attempt to run a query without passing spanner_config to register:

g = graphistry.spanner_gql_to_g(query)

Expected behavior
Should give descriptive error and how to set with register vs KeyError

Actual behavior

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-6-b9aea2069736> in <cell line: 0>()
      2 MATCH p = (a)-[b]->(c) where 1=1 {LIMIT_CLAUSE} return SAFE_TO_JSON(p) as path'''
      3 
----> 4 g = graphistry.spanner_gql_to_g(query)

1 frames
/usr/local/lib/python3.11/dist-packages/graphistry/PlotterBase.py in spanner_gql_to_g(self, query)
   2531 
   2532         if not hasattr(res, '_spannergraph'):
-> 2533             spanner_config = PyGraphistry._config["spanner"]
   2534             if spanner_config is not None:
   2535                 logger.debug(f"Spanner Config: {spanner_config}")

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions