From 8e6a9aecf750e54efd3d5369d6841aa9312f916e Mon Sep 17 00:00:00 2001
From: cmuhao <sduxuhao@gmail.com>
Date: Fri, 27 Sep 2024 00:22:11 -0700
Subject: [PATCH 1/5] fix postgres import issue

Signed-off-by: cmuhao <sduxuhao@gmail.com>
---
 sdk/python/feast/infra/online_stores/contrib/postgres.py   | 4 +---
 .../contrib/singlestore_online_store/singlestore.py        | 7 +------
 sdk/python/feast/infra/online_stores/helpers.py            | 7 +++++++
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/sdk/python/feast/infra/online_stores/contrib/postgres.py b/sdk/python/feast/infra/online_stores/contrib/postgres.py
index 8125da33be0..036c0b6b925 100644
--- a/sdk/python/feast/infra/online_stores/contrib/postgres.py
+++ b/sdk/python/feast/infra/online_stores/contrib/postgres.py
@@ -23,9 +23,7 @@
 from feast import Entity
 from feast.feature_view import FeatureView
 from feast.infra.key_encoding_utils import get_list_val_str, serialize_entity_key
-from feast.infra.online_stores.contrib.singlestore_online_store.singlestore import (
-    _to_naive_utc,
-)
+from feast.infra.online_stores.helpers import _to_naive_utc
 from feast.infra.online_stores.online_store import OnlineStore
 from feast.infra.utils.postgres.connection_utils import (
     _get_conn,
diff --git a/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py b/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py
index 3e921afceaa..29a60368eea 100644
--- a/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py
+++ b/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py
@@ -15,6 +15,7 @@
 from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
 from feast.protos.feast.types.Value_pb2 import Value as ValueProto
 from feast.repo_config import FeastConfigBaseModel
+from feast.infra.online_stores.helpers import _to_naive_utc
 
 
 class SingleStoreOnlineStoreConfig(FeastConfigBaseModel):
@@ -226,9 +227,3 @@ def _drop_table_and_index(cur: Cursor, project: str, table: FeatureView) -> None
 def _table_id(project: str, table: FeatureView) -> str:
     return f"{project}_{table.name}"
 
-
-def _to_naive_utc(ts: datetime) -> datetime:
-    if ts.tzinfo is None:
-        return ts
-    else:
-        return ts.astimezone(tz=timezone.utc).replace(tzinfo=None)
diff --git a/sdk/python/feast/infra/online_stores/helpers.py b/sdk/python/feast/infra/online_stores/helpers.py
index 0e2fdb35007..fc7869d8e83 100644
--- a/sdk/python/feast/infra/online_stores/helpers.py
+++ b/sdk/python/feast/infra/online_stores/helpers.py
@@ -62,3 +62,10 @@ def compute_entity_id(
             entity_key_serialization_version=entity_key_serialization_version,
         )
     ).hex()
+
+
+def _to_naive_utc(ts: datetime) -> datetime:
+    if ts.tzinfo is None:
+        return ts
+    else:
+        return ts.astimezone(tz=timezone.utc).replace(tzinfo=None)
\ No newline at end of file

From 15599fb99cb60aef49468d1214a02621231ec12d Mon Sep 17 00:00:00 2001
From: cmuhao <sduxuhao@gmail.com>
Date: Fri, 27 Sep 2024 00:23:20 -0700
Subject: [PATCH 2/5] fix postgres import issue

Signed-off-by: cmuhao <sduxuhao@gmail.com>
---
 .../contrib/singlestore_online_store/singlestore.py           | 4 ++--
 sdk/python/feast/infra/online_stores/helpers.py               | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py b/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py
index 29a60368eea..a1a045c808e 100644
--- a/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py
+++ b/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py
@@ -1,7 +1,7 @@
 from __future__ import absolute_import
 
 from collections import defaultdict
-from datetime import datetime, timezone
+from datetime import datetime
 from typing import Any, Callable, Dict, List, Literal, Optional, Sequence, Tuple
 
 import singlestoredb
@@ -11,11 +11,11 @@
 
 from feast import Entity, FeatureView, RepoConfig
 from feast.infra.key_encoding_utils import serialize_entity_key
+from feast.infra.online_stores.helpers import _to_naive_utc
 from feast.infra.online_stores.online_store import OnlineStore
 from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
 from feast.protos.feast.types.Value_pb2 import Value as ValueProto
 from feast.repo_config import FeastConfigBaseModel
-from feast.infra.online_stores.helpers import _to_naive_utc
 
 
 class SingleStoreOnlineStoreConfig(FeastConfigBaseModel):
diff --git a/sdk/python/feast/infra/online_stores/helpers.py b/sdk/python/feast/infra/online_stores/helpers.py
index fc7869d8e83..a8e624e4c80 100644
--- a/sdk/python/feast/infra/online_stores/helpers.py
+++ b/sdk/python/feast/infra/online_stores/helpers.py
@@ -2,6 +2,7 @@
 from typing import Any, List
 
 import mmh3
+from datetime import datetime
 
 from feast.importer import import_class
 from feast.infra.key_encoding_utils import (
@@ -68,4 +69,4 @@ def _to_naive_utc(ts: datetime) -> datetime:
     if ts.tzinfo is None:
         return ts
     else:
-        return ts.astimezone(tz=timezone.utc).replace(tzinfo=None)
\ No newline at end of file
+        return ts.astimezone(tz=timezone.utc).replace(tzinfo=None)

From a674b09e2fcc34da26b22c6c2f33c4c6d626f3ab Mon Sep 17 00:00:00 2001
From: cmuhao <sduxuhao@gmail.com>
Date: Fri, 27 Sep 2024 00:23:36 -0700
Subject: [PATCH 3/5] fix postgres import issue

Signed-off-by: cmuhao <sduxuhao@gmail.com>
---
 sdk/python/feast/infra/online_stores/helpers.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdk/python/feast/infra/online_stores/helpers.py b/sdk/python/feast/infra/online_stores/helpers.py
index a8e624e4c80..f28b6fc0092 100644
--- a/sdk/python/feast/infra/online_stores/helpers.py
+++ b/sdk/python/feast/infra/online_stores/helpers.py
@@ -1,8 +1,8 @@
 import struct
+from datetime import datetime
 from typing import Any, List
 
 import mmh3
-from datetime import datetime
 
 from feast.importer import import_class
 from feast.infra.key_encoding_utils import (

From 1b4d70c26c4f462ef624f51998e576b60e70e2a4 Mon Sep 17 00:00:00 2001
From: cmuhao <sduxuhao@gmail.com>
Date: Fri, 27 Sep 2024 00:24:29 -0700
Subject: [PATCH 4/5] fix postgres import issue

Signed-off-by: cmuhao <sduxuhao@gmail.com>
---
 sdk/python/feast/infra/online_stores/helpers.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdk/python/feast/infra/online_stores/helpers.py b/sdk/python/feast/infra/online_stores/helpers.py
index f28b6fc0092..409a1eb2126 100644
--- a/sdk/python/feast/infra/online_stores/helpers.py
+++ b/sdk/python/feast/infra/online_stores/helpers.py
@@ -1,5 +1,5 @@
 import struct
-from datetime import datetime
+from datetime import datetime, timezone
 from typing import Any, List
 
 import mmh3

From 8ecbd6c98ccd1d7d313053c721c19be70bd61979 Mon Sep 17 00:00:00 2001
From: cmuhao <sduxuhao@gmail.com>
Date: Fri, 27 Sep 2024 00:24:52 -0700
Subject: [PATCH 5/5] fix lint

Signed-off-by: cmuhao <sduxuhao@gmail.com>
---
 .../contrib/singlestore_online_store/singlestore.py              | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py b/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py
index a1a045c808e..d78289c8671 100644
--- a/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py
+++ b/sdk/python/feast/infra/online_stores/contrib/singlestore_online_store/singlestore.py
@@ -226,4 +226,3 @@ def _drop_table_and_index(cur: Cursor, project: str, table: FeatureView) -> None
 
 def _table_id(project: str, table: FeatureView) -> str:
     return f"{project}_{table.name}"
-