diff --git a/sdk/python/feast/feature_view.py b/sdk/python/feast/feature_view.py index f438511866e..bb89cda667b 100644 --- a/sdk/python/feast/feature_view.py +++ b/sdk/python/feast/feature_view.py @@ -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." diff --git a/sdk/python/feast/infra/online_stores/contrib/cassandra_online_store/cassandra_online_store.py b/sdk/python/feast/infra/online_stores/contrib/cassandra_online_store/cassandra_online_store.py index 254c9359699..c1d1f636ca7 100644 --- a/sdk/python/feast/infra/online_stores/contrib/cassandra_online_store/cassandra_online_store.py +++ b/sdk/python/feast/infra/online_stores/contrib/cassandra_online_store/cassandra_online_store.py @@ -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 ""