From c9a37516dc19112e80ee4d2d711514294cb66fd6 Mon Sep 17 00:00:00 2001 From: Shuchu Han Date: Sat, 22 Jun 2024 16:29:49 -0400 Subject: [PATCH] fix: Deprecated the datetime.utcfromtimestamp(). Signed-off-by: Shuchu Han --- sdk/python/feast/infra/registry/snowflake.py | 4 ++-- sdk/python/feast/infra/registry/sql.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/python/feast/infra/registry/snowflake.py b/sdk/python/feast/infra/registry/snowflake.py index aaf6c4c48d..d7ab67e7d0 100644 --- a/sdk/python/feast/infra/registry/snowflake.py +++ b/sdk/python/feast/infra/registry/snowflake.py @@ -2,7 +2,7 @@ import os import uuid from binascii import hexlify -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from enum import Enum from threading import Lock from typing import Any, Callable, List, Literal, Optional, Set, Union @@ -994,7 +994,7 @@ def _get_last_updated_metadata(self, project: str): if df.empty: return None - return datetime.utcfromtimestamp(int(df.squeeze())) + return datetime.fromtimestamp(int(df.squeeze()), tz=timezone.utc) def _infer_fv_classes(self, feature_view): if isinstance(feature_view, StreamFeatureView): diff --git a/sdk/python/feast/infra/registry/sql.py b/sdk/python/feast/infra/registry/sql.py index 42bd19eb5f..239898677c 100644 --- a/sdk/python/feast/infra/registry/sql.py +++ b/sdk/python/feast/infra/registry/sql.py @@ -1,6 +1,6 @@ import logging import uuid -from datetime import datetime +from datetime import datetime, timezone from enum import Enum from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Set, Union @@ -903,7 +903,7 @@ def _get_last_updated_metadata(self, project: str): return None update_time = int(row._mapping["last_updated_timestamp"]) - return datetime.utcfromtimestamp(update_time) + return datetime.fromtimestamp(update_time, tz=timezone.utc) def _get_all_projects(self) -> Set[str]: projects = set()