Skip to content

Commit

Permalink
just make online_store_ttl an int rather than timedelta
Browse files Browse the repository at this point in the history
  • Loading branch information
zabarn committed Nov 6, 2024
1 parent b45fa35 commit f756730
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions sdk/python/feast/feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,18 +496,18 @@ def most_recent_end_time(self) -> Optional[datetime]:
return max([interval[1] for interval in self.materialization_intervals])

@property
def online_store_ttl(self) -> Optional[timedelta]:
def online_store_ttl(self) -> Optional[int]:
"""
Retrieves the online store TTL from the FeatureView's tags.
Returns:
A timedelta representing the TTL, or None if not set.
An integer representing the TTL in seconds, or None if not set.
"""
ttl_str = self.tags.get("online_store_ttl")
if ttl_str:
try:
ttl_seconds = int(ttl_str)
return timedelta(seconds=ttl_seconds)
return ttl_seconds
except ValueError:
raise ValueError(
f"Invalid online_store_ttl value '{ttl_str}' in tags. It must be an integer representing seconds."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,8 @@ def _create_table(self, config: RepoConfig, project: str, table: FeatureView):
fqtable = CassandraOnlineStore._fq_table_name(keyspace, project, table)

ttl = (
int(table.online_store_ttl.total_seconds())
if table.online_store_ttl
table.online_store_ttl
if table.online_store_ttl is not None
else config.online_store.ttl
)
table_options = f" AND default_time_to_live = {ttl}" if ttl is not None else ""
Expand Down

0 comments on commit f756730

Please sign in to comment.