Skip to content

Conversation

@YassinNouh21
Copy link
Contributor

Summary

  • Adds get_table_query_string_with_alias() method to PostgreSQLSource class
  • PostgreSQL requires all subqueries in FROM clauses to have aliases, but get_table_query_string() returns unaliased subqueries
  • New method automatically adds alias for query-based sources while returning plain table names for table-based sources
  • Preserves backward compatibility by keeping existing get_table_query_string() unchanged
  • Adds comprehensive unit tests for the new method

Test Plan

  • Added unit tests for get_table_query_string_with_alias() method
  • Tests cover table-based sources, query-based sources, custom aliases, and SQL syntax validation
  • CI will run full test suite

Fixes #5605

@YassinNouh21 YassinNouh21 requested a review from a team as a code owner January 4, 2026 11:51
@YassinNouh21 YassinNouh21 force-pushed the fix/postgresql-entity-sql-alias-5605 branch 4 times, most recently from c2b0824 to b144441 Compare January 4, 2026 12:16
…aliasing

PostgreSQL requires all subqueries in FROM clauses to have aliases.
This adds a new method get_table_query_string_with_alias() to PostgreSQLSource
that automatically adds an alias when the source is query-based.

The existing get_table_query_string() is preserved for backward compatibility
and updated with documentation explaining when to use the new method.

Fixes feast-dev#5605

Signed-off-by: Yassin Nouh <yassinmnouh@gmail.com>
Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
@YassinNouh21 YassinNouh21 force-pushed the fix/postgresql-entity-sql-alias-5605 branch from b144441 to 994a632 Compare January 4, 2026 12:24
Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
@YassinNouh21
Copy link
Contributor Author

@franciscojavierarceo can u take a look into this ?

Copy link
Member

@franciscojavierarceo franciscojavierarceo left a comment

Choose a reason for hiding this comment

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

nice, it'd be good to have this run an integration test for it but it's fine.

@franciscojavierarceo franciscojavierarceo merged commit 11122ce into feast-dev:master Jan 10, 2026
21 checks passed
@YassinNouh21 YassinNouh21 deleted the fix/postgresql-entity-sql-alias-5605 branch January 10, 2026 01:22
YassinNouh21 added a commit to YassinNouh21/feast that referenced this pull request Jan 10, 2026
…aliasing (feast-dev#5811)

Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
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.

Entity SQL does not work as documented with PostgreSQL Offline Store

2 participants