Skip to content

Commit eb71367

Browse files
authored
Merge pull request #42 from epsilla-cloud/dev
upgrade python client
2 parents 8120873 + 3fef4ac commit eb71367

5 files changed

Lines changed: 73 additions & 16 deletions

File tree

ISSUE_TEMPLATE/bug_report.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**Screenshots**
14+
- If applicable, add screenshots to help explain your problem.
15+
16+
**Additional context**
17+
- Add any other context about the problem here.

ISSUE_TEMPLATE/feature_request.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: feature
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the feature**
11+
- to be filled
12+
13+
**Motivation and use case**
14+
- to be filled
15+
16+
**Additional context**
17+
- to be filled

pyepsilla/cloud/client.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ def get_db_info(self, db_id: str):
6161
res.close()
6262
return status_code, body
6363

64+
def get_db_statistics(self, db_id: str):
65+
req_url = "{}/vectordb/{}/statistics".format(self._baseurl, db_id)
66+
req_data = None
67+
res = requests.get(
68+
url=req_url, data=json.dumps(req_data), headers=self._header, verify=False
69+
)
70+
status_code = res.status_code
71+
body = res.json()
72+
res.close()
73+
return status_code, body
74+
6475
def vectordb(self, db_id: str):
6576
# validate project_id and api_key
6677
res = self.validate()
@@ -87,7 +98,14 @@ def vectordb(self, db_id: str):
8798

8899

89100
class Vectordb(Client):
90-
def __init__(self, project_id: str, db_id: str, api_key: str, public_endpoint: str, headers: dict = None):
101+
def __init__(
102+
self,
103+
project_id: str,
104+
db_id: str,
105+
api_key: str,
106+
public_endpoint: str,
107+
headers: dict = None,
108+
):
91109
self._project_id = project_id
92110
self._db_id = db_id
93111
self._api_key = api_key
@@ -111,7 +129,12 @@ def list_tables(self):
111129
return status_code, body
112130

113131
# Create table
114-
def create_table(self, table_name: str, table_fields: list[dict] = None, indices: list[dict] = None):
132+
def create_table(
133+
self,
134+
table_name: str,
135+
table_fields: list[dict] = None,
136+
indices: list[dict] = None,
137+
):
115138
if self._db_id is None:
116139
raise Exception("[ERROR] db_id is None!")
117140
if table_fields is None:

pyepsilla/vectordb/client.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ def unload_db(self, db_name: str):
106106
res.close()
107107
return status_code, body
108108

109+
def statistics(self):
110+
if self._db is None:
111+
raise Exception("[ERROR] Please use_db() first!")
112+
req_url = "{}/api/{}/statistics".format(self._baseurl, self._db)
113+
req_data = None
114+
res = requests.get(
115+
url=req_url, data=json.dumps(req_data), headers=self._header, verify=False
116+
)
117+
status_code = res.status_code
118+
body = res.json()
119+
res.close()
120+
return status_code, body
121+
109122
def create_table(
110123
self,
111124
table_name: str,
@@ -302,19 +315,6 @@ def get(
302315
res.close()
303316
return status_code, body
304317

305-
def statistics(self):
306-
if self._db is None:
307-
raise Exception("[ERROR] Please use_db() first!")
308-
req_url = "{}/api/{}/statistics".format(self._baseurl, self._db)
309-
req_data = None
310-
res = requests.get(
311-
url=req_url, data=json.dumps(req_data), headers=self._header, verify=False
312-
)
313-
status_code = res.status_code
314-
body = res.json()
315-
res.close()
316-
return status_code, body
317-
318318
def drop_table(self, table_name: str = None):
319319
if self._db is None:
320320
raise Exception("[ERROR] Please use_db() first!")

pyepsilla/vectordb/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.1"
1+
__version__ = "0.3.2"

0 commit comments

Comments
 (0)