Skip to content

Commit 6b05153

Browse files
authored
feat: SQLite online retrieval. Add timezone info into timestamp. (#5386)
add timezone info into timestamp Signed-off-by: Artem Petrov <[email protected]>
1 parent fd1f448 commit 6b05153

File tree

1 file changed

+18
-3
lines changed
  • sdk/python/feast/infra/online_stores

1 file changed

+18
-3
lines changed

sdk/python/feast/infra/online_stores/sqlite.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,20 @@
1616
import os
1717
import sqlite3
1818
import sys
19-
from datetime import date, datetime
19+
from datetime import date, datetime, timezone
2020
from pathlib import Path
21-
from typing import Any, Callable, Dict, List, Literal, Optional, Sequence, Tuple, Union
21+
from typing import (
22+
Any,
23+
Callable,
24+
Dict,
25+
List,
26+
Literal,
27+
Optional,
28+
Sequence,
29+
Tuple,
30+
Union,
31+
cast,
32+
)
2233

2334
from pydantic import StrictStr
2435

@@ -264,7 +275,11 @@ def online_read(
264275
val = ValueProto()
265276
val.ParseFromString(val_bin)
266277
res[feature_name] = val
267-
res_ts = ts
278+
ts = cast(datetime, ts)
279+
if ts.tzinfo is not None:
280+
res_ts = ts.astimezone(timezone.utc)
281+
else:
282+
res_ts = ts.replace(tzinfo=timezone.utc)
268283

269284
if not res:
270285
result.append((None, None))

0 commit comments

Comments
 (0)