fix: Column quoting in query of `PostgreSQLOfflineStore.pull_all_from… · feast-dev/feast@e8eae71

File tree

2 files changed

lines changed

    • feast/infra/offline_stores/contrib/postgres_offline_store

    • tests/unit/infra/offline_stores/contrib/postgres_offline_store

2 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -280,7 +280,10 @@ def pull_all_from_table_or_query(

280280

if created_timestamp_column:

281281

timestamp_fields.append(created_timestamp_column)

282282

field_string = ", ".join(

283-

join_key_columns + feature_name_columns + timestamp_fields

283+

_append_alias(

284+

join_key_columns + feature_name_columns + timestamp_fields,

285+

"paftoq_alias",

286+

)

284287

)

285288
286289

timestamp_filter = get_timestamp_filter_sql(

Original file line numberDiff line numberDiff line change

@@ -184,7 +184,7 @@ def test_pull_all_from_table_or_query(mock_get_conn):

184184

actual_query = retrieval_job.to_sql().strip()

185185

logger.debug("Actual query:\n%s", actual_query)

186186
187-

expected_query = """SELECT key1, key2, feature1, feature2, event_published_datetime_utc

187+

expected_query = """SELECT paftoq_alias."key1", paftoq_alias."key2", paftoq_alias."feature1", paftoq_alias."feature2", paftoq_alias."event_published_datetime_utc"

188188

FROM offline_store_database_name.offline_store_table_name AS paftoq_alias

189189

WHERE "event_published_datetime_utc" BETWEEN '2021-01-01 00:00:00+00:00'::timestamptz AND '2021-01-02 00:00:00+00:00'::timestamptz""" # noqa: W293

190190