Skip to content
Prev Previous commit
Next Next commit
format
Signed-off-by: cmuhao <sduxuhao@gmail.com>
  • Loading branch information
HaoXuAI committed May 12, 2024
commit 5a212ba487bc5ff4d17409560335238e94f5fc71
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import absolute_import

import base64
import json
import logging
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple
import base64

import pytz
from elasticsearch import Elasticsearch, helpers
Expand Down Expand Up @@ -51,6 +51,9 @@ def _get_client(self, config: RepoConfig) -> Elasticsearch:
online_store_config = config.online_store
assert isinstance(online_store_config, ElasticSearchOnlineStoreConfig)

user = online_store_config.user if online_store_config.user is not None else ''
password = online_store_config.password if online_store_config.password is not None else ''

if self._client:
return self._client
else:
Expand All @@ -62,7 +65,7 @@ def _get_client(self, config: RepoConfig) -> Elasticsearch:
"scheme": online_store_config.scheme or "http"
}
],
basic_auth=(online_store_config.user, online_store_config.password),
basic_auth=(user, password)
)
return self._client

Expand Down Expand Up @@ -230,7 +233,6 @@ def retrieve_online_documents(
)
rows = response["hits"]["hits"][0:top_k]
for row in rows:
entity_key = row["_source"]["entity_key"]
feature_value = row["_source"]["feature_value"]
vector_value = row["_source"]["vector_value"]
timestamp = row["_source"]["timestamp"]
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/infra/online_stores/contrib/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def retrieve_online_documents(
requested_feature: str,
embedding: List[float],
top_k: int,
distance_metric: str = "L2",
distance_metric: Optional[str] = "L2",
) -> List[
Tuple[
Optional[datetime],
Expand Down