Skip to content

feat: Add feature view versioning support to PostgreSQL and MySQL online stores#6193

Open
YassinNouh21 wants to merge 7 commits intofeast-dev:masterfrom
YassinNouh21:feat/postgres-mysql-versioning
Open

feat: Add feature view versioning support to PostgreSQL and MySQL online stores#6193
YassinNouh21 wants to merge 7 commits intofeast-dev:masterfrom
YassinNouh21:feat/postgres-mysql-versioning

Conversation

@YassinNouh21
Copy link
Copy Markdown
Collaborator

@YassinNouh21 YassinNouh21 commented Mar 29, 2026

Summary

  • Added versioned read/write support to PostgreSQL and MySQL online stores, following the SQLite reference implementation pattern from feat: Add version tracking to FeatureView #6101
  • When enable_online_feature_view_versioning is enabled, data is routed to version-specific tables (e.g., project_driver_stats_v2)
  • Registered both stores in _check_versioned_read_support() so version-qualified feature references (driver_stats@v2:trips_today) work correctly

Changes

PostgreSQL (postgres.py):

  • Updated _table_id() to accept enable_versioning parameter with version suffix logic
  • Updated all 6 callers: online_write_batch, _construct_query_and_params, update, teardown, retrieve_online_documents, retrieve_online_documents_v2

MySQL (mysql.py):

  • Updated _table_id() with same versioning pattern
  • Threaded enable_versioning through _execute_batch(), write_to_table(), and _drop_table_and_index()
  • Updated online_read, update, and teardown callers

Shared (online_store.py, errors.py):

  • Added PostgreSQLOnlineStore and MySQLOnlineStore to _check_versioned_read_support() allowlist
  • Updated VersionedOnlineReadNotSupported error message

Test plan

  • 7 unit tests for PostgreSQL _table_id (no version, disabled, enabled, v0, version_tag priority)
  • 7 unit tests for MySQL _table_id (same coverage)
  • 5 unit tests for _check_versioned_read_support (PostgreSQL/MySQL/SQLite allowed, unsupported raises, no tag no error)
  • 4 PostgreSQL e2e tests with real database (testcontainers): write/read without versioning, with v1, version isolation, teardown
  • 4 MySQL e2e tests with real database (testcontainers): same coverage
  • 27/27 tests passing, all lint checks pass

Closes #6168
Closes #6169
Part of #2728


Open with Devin

@YassinNouh21 YassinNouh21 requested review from a team as code owners March 29, 2026 12:56
@YassinNouh21 YassinNouh21 requested review from dmartinol, nquinn408 and redhatHameed and removed request for a team March 29, 2026 12:56
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@YassinNouh21 YassinNouh21 force-pushed the feat/postgres-mysql-versioning branch 3 times, most recently from b35410f to 0e56ae2 Compare March 29, 2026 13:17
devin-ai-integration[bot]

This comment was marked as resolved.

@YassinNouh21 YassinNouh21 force-pushed the feat/postgres-mysql-versioning branch from 75923e7 to ca254af Compare April 5, 2026 14:58
@YassinNouh21
Copy link
Copy Markdown
Collaborator Author

@franciscojavierarceo @ntkathole Can you guys check it ?

devin-ai-integration[bot]

This comment was marked as resolved.

@YassinNouh21
Copy link
Copy Markdown
Collaborator Author

@ntkathole can you check again ?

…ine stores

Add versioned read/write support so that version-qualified feature references
(e.g., driver_stats@v2:trips_today) resolve to the correct versioned table in
both PostgreSQL and MySQL online stores.

Changes:
- PostgreSQL: Updated _table_id() and all callers to support enable_versioning
- MySQL: Updated _table_id(), _execute_batch(), write_to_table(), and
  _drop_table_and_index() to thread versioning flag through
- online_store.py: Registered PostgreSQLOnlineStore and MySQLOnlineStore in
  _check_versioned_read_support()
- errors.py: Updated VersionedOnlineReadNotSupported message
- Unit tests split per store in tests/unit/infra/online_store/
- Integration tests in tests/integration/online_store/ (Docker, testcontainers)

Closes feast-dev#6168
Closes feast-dev#6169
Part of feast-dev#2728

Signed-off-by: yassinnouh21 <[email protected]>
…upport

Unconditional imports of pymysql and psycopg broke online reads for
users on other stores (Redis, DynamoDB, etc.) that don't have these
optional dependencies installed.

Signed-off-by: yassinnouh21 <[email protected]>
Teardown was only dropping the current version's table, orphaning older
versioned tables (e.g. _v1, _v2). Now queries the database catalog to
find and drop all versioned tables for each feature view.

Also extracts the duplicated _table_id logic from SQLite, MySQL, and
Postgres into a shared compute_table_id helper.

Signed-off-by: yassinnouh21 <[email protected]>
LIKE _v% could match unrelated tables (e.g. driver_verbose when
dropping versions for driver). Switch to REGEXP/~ with _v[0-9]+$
pattern. Also scope Postgres pg_tables query by schemaname.

Signed-off-by: yassinnouh21 <[email protected]>
@ntkathole ntkathole force-pushed the feat/postgres-mysql-versioning branch from 4fb6a34 to 386d01a Compare April 6, 2026 11:04
@ntkathole
Copy link
Copy Markdown
Member

@YassinNouh21 looks like versioning test failing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add feature view versioning support to MySQL online store Add feature view versioning support to PostgreSQL online store

2 participants