Visitar URL original
feat: Offline store update pull_all_from_table_or_query to make timestampfield optional by haoxu0 · Pull Request #5281 · feast-dev/feast · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix test
Signed-off-by: HaoXuAI <sduxuhao@gmail.com>
  • Loading branch information
haoxu0 committed Apr 18, 2025
commit 23a0fb41be08afa06313aa2468885f4917500922
6 changes: 3 additions & 3 deletions sdk/python/feast/infra/offline_stores/offline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def get_timestamp_filter_sql(
timestamp_field: Optional[str] = DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL,
date_partition_column: Optional[str] = None,
tz: Optional[timezone] = None,
cast_style: Literal["timestamp_func", "timestamptz", "raw"] = "timestamp_func",
cast_style: Literal["timestamp_func", "timestamp", "timestamptz", "raw"] = "timestamp_func",
date_time_separator: str = "T",
quote_fields: bool = True,
) -> str:
Expand Down Expand Up @@ -314,8 +314,8 @@ def format_casted_ts(val: Union[str, datetime]) -> str:

if cast_style == "timestamp_func":
return f"TIMESTAMP('{val_str}')"
elif cast_style == "timestamptz":
return f"'{val_str}'::timestamptz"
elif cast_style in ("timestamptz", "timestamp"):
return f"'{val_str}'::{cast_style}"
else:
return f"'{val_str}'"

Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/infra/offline_stores/redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def pull_all_from_table_or_query(
s3_resource = aws_utils.get_s3_resource(config.offline_store.region)

timestamp_filter = get_timestamp_filter_sql(
start_date, end_date, timestamp_field, tz=timezone.utc
start_date, end_date, timestamp_field, tz=timezone.utc, cast_style="timestamp"
)

query = f"""
Expand Down