Skip to content

fix(sessions): Port PostgreSQL binary event actions migration fix to v1 - #6870

Open
shoemoney wants to merge 1 commit into
google:v1from
shoemoney:fix/v1-migration-memoryview
Open

fix(sessions): Port PostgreSQL binary event actions migration fix to v1#6870
shoemoney wants to merge 1 commit into
google:v1from
shoemoney:fix/v1-migration-memoryview

Conversation

@shoemoney

Copy link
Copy Markdown

This PR ports one session-migration commit to the v1 branch:

PostgreSQL binary event actions fix (e3ae4ac)

  • _row_to_event reads v0 event rows with raw SQL, so SQLAlchemy has no column type to coerce with and the driver's own binary representation reaches the migration. psycopg2 returns BYTEA columns as memoryview, which failed the isinstance(actions_val, bytes) check and fell into the "backend returned an object" path, so every migrated event's actions were silently replaced with an empty EventActions while the migration reported success.
  • The check now accepts bytes, bytearray and memoryview and coerces with bytes() before unpickling. The Spanner object path is unchanged.
  • Ports the parametrized regression test, which constructs each binary type in-process; on unfixed v1 the memoryview and bytearray cases fail with actions == {}.

Tested: tests/unittests/sessions/migration/test_migration.py, 36 passed on v1.

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