Skip to content

fix(sqlalchemy-spanner): register TOKENLIST in _type_map for reflection - #17911

Merged
sakthivelmanii merged 1 commit into
mainfrom
fix-spanner-reflection-tokenlist-type
Jul 27, 2026
Merged

fix(sqlalchemy-spanner): register TOKENLIST in _type_map for reflection#17911
sakthivelmanii merged 1 commit into
mainfrom
fix-spanner-reflection-tokenlist-type

Conversation

@sakthivelmanii

Copy link
Copy Markdown
Contributor

Table reflection raises KeyError: 'TOKENLIST' whenever a table containing a TOKENLIST column is reflected.

Fixes this issue by registering "TOKENLIST": types.String in _type_map in google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@sakthivelmanii
sakthivelmanii requested a review from a team as a code owner July 27, 2026 14:59

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for mapping the Spanner 'TOKENLIST' type to SQLAlchemy's 'types.String' and includes a test to verify this mapping. The review feedback suggests optimizing the new test by inheriting from 'unittest.TestCase' instead of 'MockServerTestBase' to avoid unnecessary overhead, since the test only asserts static type mapping and does not require a mock database server.

Comment thread packages/sqlalchemy-spanner/tests/mockserver_tests/test_tokenlist.py Outdated

@olavloite olavloite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change LGTM, but the suggestion from Gemini for the test should indeed be applied.

Table reflection raises KeyError: 'TOKENLIST' whenever a table containing
a TOKENLIST column is reflected.

Fixes this issue by registering "TOKENLIST": types.String in _type_map
in google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py.
@sakthivelmanii
sakthivelmanii force-pushed the fix-spanner-reflection-tokenlist-type branch from 0702c7d to 527f180 Compare July 27, 2026 15:12
@sakthivelmanii
sakthivelmanii merged commit 788208b into main Jul 27, 2026
41 of 42 checks passed
@sakthivelmanii
sakthivelmanii deleted the fix-spanner-reflection-tokenlist-type branch July 27, 2026 17:01
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