Skip to content

GraphServer: Remove reliance on CloudSpanner's TypeCode#48

Merged
cqian23 merged 5 commits into
cloudspannerecosystem:mainfrom
smukil:graph_server_rmv_typecode
Jun 12, 2025
Merged

GraphServer: Remove reliance on CloudSpanner's TypeCode#48
cqian23 merged 5 commits into
cloudspannerecosystem:mainfrom
smukil:graph_server_rmv_typecode

Conversation

@smukil
Copy link
Copy Markdown
Collaborator

@smukil smukil commented Jun 12, 2025

The google.cloud.spanner.TypeCode was used to validate supported
types for properties. However, the type information is always
received as a string from the JS client. It is only internally converted
to a TypeCode for verification.

Comparing against the TypeCode does not make the validation any more
robust than just confirming if the strings themselves are valid type
strings.

Removing reliance on TypeCode also makes GraphServer database agnostic.

Sailesh Mukil and others added 5 commits June 12, 2025 11:16
- Also removes cloud-spanner specific fields from the return type.
  Specifically `StructType.Field` is removed from the return type.
  Removing this tightly coupled logic is required to allow new DB
  implementations.
…f DB implementation with APIs

1. Abstracts SpannerDatabase with clear APIs
2. Introduces CloudSpannerDatabase as an implementation of SpannerDatabase
3. Removes further tight coupling with the cloud spanner client by adding a
   SpannerFieldInfo dataclass to replace usage of StructType.Field
1. The global database_instances is moved to exec_env.py to avoid
   circular imports.

2. SpannerFiledInfo.typename populated with the correct name now

3. Remove all cloud spanner refs from database.py
The google.cloud.spanner.TypeCode was used to validate supported
types for properties. However, the type information is always
received as a string from the JS client. It is only internally converted
to a TypeCode for verification.

Comparing against the TypeCode does not make the validation any more
robust than just confirming if the strings themselves are valid type
strings.

Removing reliance on TypeCode also makes GraphServer database agnostic.
All consumers of SpannerQueryResult expect `err` instead of `error`.
Without this fix, failures are silent. With this, they're displayed
within the notebook.

Thanks to @cqian23 for pointing this out
@smukil smukil force-pushed the graph_server_rmv_typecode branch from 3e5a6cc to d0e2a5e Compare June 12, 2025 18:20
@cqian23 cqian23 merged commit 194f3e3 into cloudspannerecosystem:main Jun 12, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants