Skip to content

Commit 6e1e887

Browse files
committed
update query function of pyepsilla cloud client
1 parent a265563 commit 6e1e887

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

pyepsilla/cloud/client.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,23 @@ def insert(self, table_name: str, records: list[dict]):
9696
body = res.json()
9797
return status_code, body
9898

99-
10099
## query data from table
101-
def query(self, table_name: str, query_field: str = "", query_vector: list = None, response_fields: list = None, limit: int = 1, with_distance: bool = False):
100+
def query(self, table_name: str, query_field: str = None, query_vector: list = None, response_fields: Optional[list] = None, limit: int = 2, filter: Optional[str] = None, with_distance: Optional[bool] = False):
102101
req_url = "{}/data/query".format(self._baseurl)
103-
req_data = {
104-
"table": table_name,
105-
"queryField": query_field,
106-
"queryVector": query_vector,
107-
"response": response_fields,
108-
"limit": limit,
109-
"withDistance": with_distance
110-
}
102+
req_data = { "table": table_name }
103+
if query_field != None:
104+
req_data["queryField"] = query_field
105+
if query_vector != None:
106+
req_data["queryVector"] = query_vector
107+
if response_fields != None:
108+
req_data["response"] = response_fields
109+
if limit != None:
110+
req_data["limit"] = limit
111+
if filter != None:
112+
req_data["filter"] = filter
113+
if with_distance != None:
114+
req_data["withDistance"] = with_distance
115+
111116
res = requests.post(url=req_url, data=json.dumps(req_data), headers=self._header)
112117
status_code = res.status_code
113118
body = res.json()

pyepsilla/vectordb/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.1.20'
1+
__version__ = '0.1.21'

0 commit comments

Comments
 (0)