pyobvector 0.2.5__tar.gz → 0.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyobvector-0.2.5 → pyobvector-0.2.7}/PKG-INFO +2 -2
- {pyobvector-0.2.5 → pyobvector-0.2.7}/README.md +1 -1
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/client/ob_vec_client.py +3 -2
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/client/ob_vec_json_table_client.py +20 -5
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyproject.toml +1 -1
- {pyobvector-0.2.5 → pyobvector-0.2.7}/LICENSE +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/__init__.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/client/__init__.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/client/collection_schema.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/client/enum.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/client/exceptions.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/client/fts_index_param.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/client/index_param.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/client/milvus_like_client.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/client/partitions.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/client/schema_type.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/json_table/__init__.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/json_table/json_value_returning_func.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/json_table/oceanbase_dialect.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/json_table/virtual_data_type.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/__init__.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/dialect.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/full_text_index.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/geo_srid_point.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/gis_func.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/match_against_func.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/ob_table.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/reflection.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/replace_stmt.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/vec_dist_func.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/vector.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/schema/vector_index.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/util/__init__.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/util/ob_version.py +0 -0
- {pyobvector-0.2.5 → pyobvector-0.2.7}/pyobvector/util/vector.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pyobvector
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: A python SDK for OceanBase Vector Store, based on SQLAlchemy, compatible with Milvus API.
|
|
5
5
|
Author: shanhaikang.shk
|
|
6
6
|
Author-email: shanhaikang.shk@oceanbase.com
|
|
@@ -36,7 +36,7 @@ poetry install
|
|
|
36
36
|
- install with pip:
|
|
37
37
|
|
|
38
38
|
```shell
|
|
39
|
-
pip install pyobvector==0.2.
|
|
39
|
+
pip install pyobvector==0.2.7
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
## Build Doc
|
|
@@ -20,6 +20,7 @@ from sqlalchemy.exc import NoSuchTableError
|
|
|
20
20
|
from sqlalchemy.dialects import registry
|
|
21
21
|
import sqlalchemy.sql.functions as func_mod
|
|
22
22
|
import numpy as np
|
|
23
|
+
from urllib.parse import quote
|
|
23
24
|
from .index_param import IndexParams, IndexParam
|
|
24
25
|
from .fts_index_param import FtsIndexParam
|
|
25
26
|
from ..schema import (
|
|
@@ -67,8 +68,8 @@ class ObVecClient:
|
|
|
67
68
|
setattr(func_mod, "st_dwithin", st_dwithin)
|
|
68
69
|
setattr(func_mod, "st_astext", st_astext)
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
password = password
|
|
71
|
+
user = quote(user, safe="")
|
|
72
|
+
password = quote(password, safe="")
|
|
72
73
|
|
|
73
74
|
connection_str = (
|
|
74
75
|
f"mysql+oceanbase://{user}:{password}@{uri}/{db_name}?charset=utf8mb4"
|
|
@@ -72,7 +72,7 @@ class ObVecJsonTableClient(ObVecClient):
|
|
|
72
72
|
if col_type == 'VARCHAR':
|
|
73
73
|
factory = JsonTableVarcharFactory(255)
|
|
74
74
|
else:
|
|
75
|
-
varchar_pattern = r'VARCHAR\((\d+)\)'
|
|
75
|
+
varchar_pattern = r'VARCHAR\s*\((\d+)\)'
|
|
76
76
|
varchar_matches = re.findall(varchar_pattern, col_type)
|
|
77
77
|
factory = JsonTableVarcharFactory(int(varchar_matches[0]))
|
|
78
78
|
model = factory.get_json_table_varchar_type()
|
|
@@ -163,7 +163,7 @@ class ObVecJsonTableClient(ObVecClient):
|
|
|
163
163
|
def refresh_metadata(self) -> None:
|
|
164
164
|
self.jmetadata.reflect(self.engine)
|
|
165
165
|
|
|
166
|
-
def perform_json_table_sql(self, sql: str) -> Optional[CursorResult]:
|
|
166
|
+
def perform_json_table_sql(self, sql: str, select_with_data_id: bool = False) -> Optional[CursorResult]:
|
|
167
167
|
"""Perform common SQL that operates on JSON Table."""
|
|
168
168
|
ast = parse_one(sql, dialect="oceanbase")
|
|
169
169
|
if isinstance(ast, exp.Create):
|
|
@@ -185,7 +185,7 @@ class ObVecJsonTableClient(ObVecClient):
|
|
|
185
185
|
self._handle_jtable_dml_delete(ast)
|
|
186
186
|
return None
|
|
187
187
|
elif isinstance(ast, exp.Select):
|
|
188
|
-
return self._handle_jtable_dml_select(ast)
|
|
188
|
+
return self._handle_jtable_dml_select(ast, select_with_data_id)
|
|
189
189
|
else:
|
|
190
190
|
raise ValueError(f"{type(ast)} not supported")
|
|
191
191
|
|
|
@@ -788,7 +788,7 @@ class ObVecJsonTableClient(ObVecClient):
|
|
|
788
788
|
return "DECIMAL(10, 0)"
|
|
789
789
|
return jdata_type
|
|
790
790
|
|
|
791
|
-
def _handle_jtable_dml_select(self, ast: Expression):
|
|
791
|
+
def _handle_jtable_dml_select(self, ast: Expression, select_with_data_id: bool = False):
|
|
792
792
|
table_name = ast.args['from'].this.this.this
|
|
793
793
|
if not self._check_table_exists(table_name):
|
|
794
794
|
raise ValueError(f"Table {table_name} does not exists")
|
|
@@ -807,6 +807,20 @@ class ObVecJsonTableClient(ObVecClient):
|
|
|
807
807
|
|
|
808
808
|
need_replace_select_exprs = False
|
|
809
809
|
new_select_exprs = []
|
|
810
|
+
|
|
811
|
+
if select_with_data_id:
|
|
812
|
+
data_id_col_expr = exp.Column()
|
|
813
|
+
data_id_identifier = exp.Identifier()
|
|
814
|
+
data_id_identifier.args['this'] = 'jdata_id'
|
|
815
|
+
data_id_identifier.args['quoted'] = False
|
|
816
|
+
data_json_table_identifier = exp.Identifier()
|
|
817
|
+
data_json_table_identifier.args['this'] = JSON_TABLE_DATA_TABLE_NAME
|
|
818
|
+
data_json_table_identifier.args['quoted'] = False
|
|
819
|
+
data_id_col_expr.args['this'] = data_id_identifier
|
|
820
|
+
data_id_col_expr.args['table'] = data_json_table_identifier
|
|
821
|
+
new_select_exprs.append(data_id_col_expr)
|
|
822
|
+
need_replace_select_exprs = True
|
|
823
|
+
|
|
810
824
|
for select_expr in ast.args['expressions']:
|
|
811
825
|
if isinstance(select_expr, exp.Star):
|
|
812
826
|
need_replace_select_exprs = True
|
|
@@ -827,7 +841,8 @@ class ObVecJsonTableClient(ObVecClient):
|
|
|
827
841
|
|
|
828
842
|
for col in ast.find_all(exp.Column):
|
|
829
843
|
if 'table' in col.args.keys():
|
|
830
|
-
col.args['table'].args['this']
|
|
844
|
+
if col.args['table'].args['this'] != JSON_TABLE_DATA_TABLE_NAME:
|
|
845
|
+
col.args['table'].args['this'] = tmp_table_name
|
|
831
846
|
else:
|
|
832
847
|
identifier = exp.Identifier()
|
|
833
848
|
identifier.args['this'] = tmp_table_name
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pyobvector"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.7"
|
|
4
4
|
description = "A python SDK for OceanBase Vector Store, based on SQLAlchemy, compatible with Milvus API."
|
|
5
5
|
authors = ["shanhaikang.shk <shanhaikang.shk@oceanbase.com>"]
|
|
6
6
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|