提交 e651a07e 编写于 作者: Y Yang Xuan

feat(python): build docs, fix examples bug


Former-commit-id: 79d4b0556dc9caeb432bf7981fc32e4302e48411
上级 3367c154
......@@ -128,7 +128,7 @@ class ConnectIntf(object):
:type uri: str
:param uri: (Optional) uri
:return Status, indicate if connect is successful
:return: Status, indicate if connect is successful
"""
_abstract()
......@@ -137,7 +137,7 @@ class ConnectIntf(object):
connected, connection status
Should be implemented
:return Status, indicate if connect is successful
:return: Status, indicate if connect is successful
"""
_abstract()
......@@ -146,7 +146,7 @@ class ConnectIntf(object):
Disconnect, server will be disconnected after disconnect return SUCCESS
Should be implemented
:return Status, indicate if connect is successful
:return: Status, indicate if connect is successful
"""
_abstract()
......@@ -158,7 +158,7 @@ class ConnectIntf(object):
:type param: TableSchema
:param param: provide table information to be created
:return Status, indicate if connect is successful
:return: Status, indicate if connect is successful
"""
_abstract()
......@@ -170,7 +170,7 @@ class ConnectIntf(object):
:type table_name: str
:param table_name: table_name of the deleting table
:return Status, indicate if connect is successful
:return: Status, indicate if connect is successful
"""
_abstract()
......@@ -185,7 +185,7 @@ class ConnectIntf(object):
:type records: list[RowRecord]
:param records: list of vectors been inserted
:returns
:returns:
Status : indicate if vectors inserted successfully
ids :list of id, after inserted every vector is given a id
"""
......@@ -209,7 +209,7 @@ class ConnectIntf(object):
:type top_k: int
:param top_k: how many similar vectors will be searched
:returns
:returns:
Status: indicate if query is successful
query_results: list[TopKQueryResult]
"""
......@@ -223,7 +223,7 @@ class ConnectIntf(object):
:type table_name: str
:param table_name: which table to be shown
:returns
:returns:
Status: indicate if query is successful
table_schema: TableSchema, given when operation is successful
"""
......@@ -237,7 +237,7 @@ class ConnectIntf(object):
:type table_name, str
:param table_name, target table name.
:returns
:returns:
Status: indicate if operation is successful
count: int, table row count
"""
......@@ -248,7 +248,7 @@ class ConnectIntf(object):
Show all tables in database
should be implemented
:return
:return:
Status: indicate if this operation is successful
tables: list[str], list of table names
"""
......
......@@ -26,8 +26,8 @@ from client.Exceptions import (
LOGGER = logging.getLogger(__name__)
__VERSION__ = '0.0.1'
__NAME__ = 'Thrift_Client'
__VERSION__ = '0.1.0'
__NAME__ = 'Milvus Python SDK'
class Prepare(object):
......@@ -39,13 +39,16 @@ class Prepare(object):
index_type=IndexType.INVALIDE,
store_raw_vector = False):
"""
:param table_name: str, (Required) name of table
:param index_type: IndexType, (Required) index type, default = IndexType.INVALID
:param dimension: int64, (Optional) dimension of the table
:param store_raw_vector: bool, (Optional) default = False
:return: TableSchema
:type table_name: str
:type dimension: int
:type index_type: IndexType
:type store_raw_vector: bool
:param table_name: (Required) name of table
:param dimension: (Required) dimension of the table
:param index_type: (Optional) index type, default = IndexType.INVALID
:param store_raw_vector: (Optional) default = False
:return: TableSchema object
"""
temp = TableSchema(table_name,dimension, index_type, store_raw_vector)
......@@ -57,10 +60,12 @@ class Prepare(object):
@classmethod
def range(cls, start, end):
"""
:param start: str, (Required) range start
:param end: str (Required) range end
:type start: str
:type end: str
:param start: (Required) range start
:param end: (Required) range end
:return Range
:return: Range object
"""
temp = Range(start=start, end=end)
return ttypes.Range(start_value=temp.start, end_value=temp.end)
......@@ -68,9 +73,12 @@ class Prepare(object):
@classmethod
def row_record(cls, vector_data):
"""
Record inserted
Transfer a float binary str to RowRecord and return
:type vector_data: bytearray or bytes
:param vector_data: (Required) binary vector to store
:param vector_data: float binary str, (Required) a binary str
:return: RowRecord object
"""
temp = RowRecord(vector_data)
......@@ -78,6 +86,9 @@ class Prepare(object):
class Milvus(ConnectIntf):
"""
The Milvus object is used to connect and communicate with the server
"""
def __init__(self):
self.status = None
......@@ -88,6 +99,20 @@ class Milvus(ConnectIntf):
return '{}'.format(self.status)
def connect(self, host='localhost', port='9090', uri=None):
"""
Connect method should be called before any operations.
Server will be connected after connect return OK
:type host: str
:type port: str
:type uri: str
:param host: (Required) host of the server
:param port: (Required) port of the server
:param uri: (Optional)
:return: Status, indicate if connect is successful
:rtype: Status
"""
# TODO URI
if self.status and self.status == Status.SUCCESS:
raise RepeatingConnectError("You have already connected!")
......@@ -110,9 +135,21 @@ class Milvus(ConnectIntf):
@property
def connected(self):
"""
Check if client is connected to the server
:return: if client is connected
:rtype bool
"""
return self.status == Status.SUCCESS
def disconnect(self):
"""
Disconnect the client
:return: Status, indicate if disconnect is successful
:rtype: Status
"""
if not self._transport:
raise DisconnectNotConnectedClientError('Error')
......@@ -130,11 +167,13 @@ class Milvus(ConnectIntf):
def create_table(self, param):
"""Create table
:param param: Provide table information to be created,
:type param: TableSchema
:param param: Provide table information to be created
`Please use Prepare.table_schema generate param`
:return: Status, indicate if operation is successful
:rtype: Status
"""
if not self._client:
raise NotConnectError('Please Connect to the server first!')
......@@ -147,11 +186,14 @@ class Milvus(ConnectIntf):
return Status(message='Table {} created!'.format(param.table_name))
def delete_table(self, table_name):
"""Delete table
"""
Delete table with table_name
:type table_name: str
:param table_name: Name of the table being deleted
:return: Status, indicate if operation is successful
:rtype: Status
"""
try:
self._client.DeleteTable(table_name)
......@@ -164,14 +206,19 @@ class Milvus(ConnectIntf):
"""
Add vectors to table
:type table_name: str
:type records: list[RowRecord]
:param table_name: table name been inserted
:param records: List[RowRecord], list of vectors been inserted
:param records: list of vectors been inserted
`Please use Prepare.row_record generate records`
:returns:
Status : indicate if vectors inserted successfully
ids :list of id, after inserted every vector is given a id
Status: indicate if vectors inserted successfully
ids: list of id, after inserted every vector is given a id
:rtype: (Status, list(str))
"""
try:
ids = self._client.AddVector(table_name=table_name, record_array=records)
......@@ -184,17 +231,26 @@ class Milvus(ConnectIntf):
"""
Query vectors in a table
:param table_name: str, table name been queried
:param query_records: list[QueryRecord], all vectors going to be queried
`Please use Prepare.query_record generate QueryRecord`
:param query_ranges: Optional ranges for conditional search.
If not specified, search whole table
:type query_ranges: list[Range]
:param table_name: table name been queried
:type table_name: str
:param query_records: all vectors going to be queried
`Please use Prepare.query_record generate QueryRecord`
:type query_records: list[RowRecord]
:param top_k: int, how many similar vectors will be searched
:param query_ranges, (Optional) list[Range], search range
:type top_k: int
:returns: (Status, res)
:returns:
Status: indicate if query is successful
res: list[TopKQueryResult], return when operation is successful
res: return when operation is successful
:rtype: (Status, list[TopKQueryResult])
"""
res = []
try:
......@@ -219,17 +275,17 @@ class Milvus(ConnectIntf):
"""
Show table information
:param table_name: str, which table to be shown
:type table_name: str
:param table_name: which table to be shown
:returns:
:returns: (Status, table_schema)
Status: indicate if query is successful
table_schema: TableSchema, return when operation is successful
table_schema: return when operation is successful
:rtype: (Status, TableSchema)
"""
try:
temp = self._client.DescribeTable(table_name)
# res = TableSchema(table_name=temp.table_name, dimension=temp.dimension,
# index_type=temp.index_type, store_raw_vector=temp.store_raw_vector)
except (TApplicationException, TException) as e:
LOGGER.error('{}'.format(e))
return Status(Status.PERMISSION_DENIED, str(e)), None
......@@ -241,14 +297,17 @@ class Milvus(ConnectIntf):
:return:
Status: indicate if this operation is successful
tables: list[str], list of table names, return when operation
tables: list of table names, return when operation
is successful
:rtype:
(Status, list[str])
"""
try:
res = self._client.ShowTables()
tables = []
if res:
tables, _ = res
tables = res
except (TApplicationException, TException) as e:
LOGGER.error('{}'.format(e))
......@@ -259,16 +318,17 @@ class Milvus(ConnectIntf):
"""
Get table row count
:type table_name, str
:param table_name, target table name.
:type table_name: str
:param table_name: target table name.
:returns:
Status: indicate if operation is successful
res: int, table row count
"""
try:
count, _ = self._client.GetTableRowCount(table_name)
count = self._client.GetTableRowCount(table_name)
except (TApplicationException, TException) as e:
LOGGER.error('{}'.format(e))
......@@ -280,6 +340,7 @@ class Milvus(ConnectIntf):
Provide client version
:return: Client version
:rtype: str
"""
return __VERSION__
......@@ -299,6 +360,7 @@ class Milvus(ConnectIntf):
Provide server status
:return: Server status
:rtype : str
"""
if not self.connected:
raise NotConnectError('You have to connect first')
......
class Status(object):
"""
:attribute code : int (optional) default as ok
:attribute message : str (optional) current status message
:attribute code: int (optional) default as ok
:attribute message: str (optional) current status message
"""
SUCCESS = 0
CONNECT_FAILED = 1
......
sdk.client.Client module
===============================
sdk.client.Client.Milvus
--------------------------------
.. autoclass:: client.Client.Milvus
:members:
:undoc-members:
:show-inheritance:
sdk.client.Clinet.Prepare
--------------------------------
.. autoclass:: client.Client.Prepare
:members:
:undoc-members:
:show-inheritance:
sdk.client.Status module
======================================
.. automodule:: client.Status
:members:
:undoc-members:
:show-inheritance:
API
***
client package
==============================
.. toctree::
:maxdepth: 2
API/sdk.client.rst
\ No newline at end of file
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.abspath(__file__)),
os.path.join('..', '..')
))
# -- Project information -----------------------------------------------------
project = 'MilvusPythonSDK'
copyright = '2019, Zilliz'
author = 'YangXuan'
# The full version, including alpha/beta/rc tags
release = '0.0.1'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
# 'sphinx.ext.viewcode'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
master_doc = 'index'
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
.. MilvusSDK documentation master file, created by
sphinx-quickstart on Thu Jun 13 11:42:09 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. raw:: html
<div style="font-size:80px;font-family:Arial;font-weight:bold;">
<i class="fa fa-check-square" style="color:green;padding-right:5px;"></i>
Milvus
</div>
Milvus Python SDK
---------------------------
Using Milvus with Python
.. toctree::
:maxdepth: 2
:hidden:
QuickStart
api
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module Abstract</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>Abstract</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href="../..">index</a><br><a href="file:/home/yangxuan/vecwise_engine/python/sdk/client/Abstract.py">/home/yangxuan/vecwise_engine/python/sdk/client/Abstract.py</a></font></td></tr></table>
<p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="client.Abstract.html#ConnectIntf">ConnectIntf</a>
</font></dt><dt><font face="helvetica, arial"><a href="client.Abstract.html#QueryResult">QueryResult</a>
</font></dt><dt><font face="helvetica, arial"><a href="client.Abstract.html#Range">Range</a>
</font></dt><dt><font face="helvetica, arial"><a href="client.Abstract.html#RowRecord">RowRecord</a>
</font></dt><dt><font face="helvetica, arial"><a href="client.Abstract.html#TableSchema">TableSchema</a>
</font></dt><dt><font face="helvetica, arial"><a href="client.Abstract.html#TopKQueryResult">TopKQueryResult</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="enum.html#IntEnum">enum.IntEnum</a>(<a href="builtins.html#int">builtins.int</a>, <a href="enum.html#Enum">enum.Enum</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="client.Abstract.html#IndexType">IndexType</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="ConnectIntf">class <strong>ConnectIntf</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>SDK&nbsp;client&nbsp;abstract&nbsp;class<br>
&nbsp;<br>
Connection&nbsp;is&nbsp;a&nbsp;abstract&nbsp;class<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="ConnectIntf-add_vectors"><strong>add_vectors</strong></a>(self, table_name, records)</dt><dd><tt>Add&nbsp;vectors&nbsp;to&nbsp;table<br>
Should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:type&nbsp;&nbsp;table_name:&nbsp;str<br>
:param&nbsp;table_name:&nbsp;table&nbsp;name&nbsp;been&nbsp;inserted<br>
&nbsp;<br>
:type&nbsp;&nbsp;records:&nbsp;list[<a href="#RowRecord">RowRecord</a>]<br>
:param&nbsp;records:&nbsp;list&nbsp;of&nbsp;vectors&nbsp;been&nbsp;inserted<br>
&nbsp;<br>
:returns<br>
&nbsp;&nbsp;&nbsp;&nbsp;Status&nbsp;:&nbsp;indicate&nbsp;if&nbsp;vectors&nbsp;inserted&nbsp;successfully<br>
&nbsp;&nbsp;&nbsp;&nbsp;ids&nbsp;:list&nbsp;of&nbsp;id,&nbsp;after&nbsp;inserted&nbsp;every&nbsp;vector&nbsp;is&nbsp;given&nbsp;a&nbsp;id</tt></dd></dl>
<dl><dt><a name="ConnectIntf-client_version"><strong>client_version</strong></a>(self)</dt><dd><tt>Provide&nbsp;client&nbsp;version<br>
should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:return:&nbsp;str,&nbsp;client&nbsp;version</tt></dd></dl>
<dl><dt><a name="ConnectIntf-connect"><strong>connect</strong></a>(self, host=None, port=None, uri=None)</dt><dd><tt>Connect&nbsp;method&nbsp;should&nbsp;be&nbsp;called&nbsp;before&nbsp;any&nbsp;operations<br>
Server&nbsp;will&nbsp;be&nbsp;connected&nbsp;after&nbsp;connect&nbsp;return&nbsp;OK<br>
Should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:type&nbsp;&nbsp;host:&nbsp;str<br>
:param&nbsp;host:&nbsp;host<br>
&nbsp;<br>
:type&nbsp;&nbsp;port:&nbsp;str<br>
:param&nbsp;port:&nbsp;port<br>
&nbsp;<br>
:type&nbsp;&nbsp;uri:&nbsp;str<br>
:param&nbsp;uri:&nbsp;(Optional)&nbsp;uri<br>
&nbsp;<br>
:return&nbsp;Status,&nbsp;&nbsp;indicate&nbsp;if&nbsp;connect&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="ConnectIntf-connected"><strong>connected</strong></a>(self)</dt><dd><tt>connected,&nbsp;connection&nbsp;status<br>
Should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:return&nbsp;Status,&nbsp;&nbsp;indicate&nbsp;if&nbsp;connect&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="ConnectIntf-create_table"><strong>create_table</strong></a>(self, param)</dt><dd><tt>Create&nbsp;table<br>
Should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:type&nbsp;&nbsp;param:&nbsp;<a href="#TableSchema">TableSchema</a><br>
:param&nbsp;param:&nbsp;provide&nbsp;table&nbsp;information&nbsp;to&nbsp;be&nbsp;created<br>
&nbsp;<br>
:return&nbsp;Status,&nbsp;indicate&nbsp;if&nbsp;connect&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="ConnectIntf-delete_table"><strong>delete_table</strong></a>(self, table_name)</dt><dd><tt>Delete&nbsp;table<br>
Should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:type&nbsp;&nbsp;table_name:&nbsp;str<br>
:param&nbsp;table_name:&nbsp;table_name&nbsp;of&nbsp;the&nbsp;deleting&nbsp;table<br>
&nbsp;<br>
:return&nbsp;Status,&nbsp;indicate&nbsp;if&nbsp;connect&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="ConnectIntf-describe_table"><strong>describe_table</strong></a>(self, table_name)</dt><dd><tt>Show&nbsp;table&nbsp;information<br>
Should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:type&nbsp;&nbsp;table_name:&nbsp;str<br>
:param&nbsp;table_name:&nbsp;which&nbsp;table&nbsp;to&nbsp;be&nbsp;shown<br>
&nbsp;<br>
:returns<br>
&nbsp;&nbsp;&nbsp;&nbsp;Status:&nbsp;indicate&nbsp;if&nbsp;query&nbsp;is&nbsp;successful<br>
&nbsp;&nbsp;&nbsp;&nbsp;table_schema:&nbsp;<a href="#TableSchema">TableSchema</a>,&nbsp;given&nbsp;when&nbsp;operation&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="ConnectIntf-disconnect"><strong>disconnect</strong></a>(self)</dt><dd><tt>Disconnect,&nbsp;server&nbsp;will&nbsp;be&nbsp;disconnected&nbsp;after&nbsp;disconnect&nbsp;return&nbsp;SUCCESS<br>
Should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:return&nbsp;Status,&nbsp;&nbsp;indicate&nbsp;if&nbsp;connect&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="ConnectIntf-get_table_row_count"><strong>get_table_row_count</strong></a>(self, table_name)</dt><dd><tt>Get&nbsp;table&nbsp;row&nbsp;count<br>
Should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:type&nbsp;&nbsp;table_name,&nbsp;str<br>
:param&nbsp;table_name,&nbsp;target&nbsp;table&nbsp;name.<br>
&nbsp;<br>
:returns<br>
&nbsp;&nbsp;&nbsp;&nbsp;Status:&nbsp;indicate&nbsp;if&nbsp;operation&nbsp;is&nbsp;successful<br>
&nbsp;&nbsp;&nbsp;&nbsp;count:&nbsp;int,&nbsp;table&nbsp;row&nbsp;count</tt></dd></dl>
<dl><dt><a name="ConnectIntf-search_vectors"><strong>search_vectors</strong></a>(self, table_name, query_records, query_ranges, top_k)</dt><dd><tt>Query&nbsp;vectors&nbsp;in&nbsp;a&nbsp;table<br>
Should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:type&nbsp;&nbsp;table_name:&nbsp;str<br>
:param&nbsp;table_name:&nbsp;table&nbsp;name&nbsp;been&nbsp;queried<br>
&nbsp;<br>
:type&nbsp;&nbsp;query_records:&nbsp;list[<a href="#RowRecord">RowRecord</a>]<br>
:param&nbsp;query_records:&nbsp;all&nbsp;vectors&nbsp;going&nbsp;to&nbsp;be&nbsp;queried<br>
&nbsp;<br>
:type&nbsp;&nbsp;query_ranges:&nbsp;list[<a href="#Range">Range</a>]<br>
:param&nbsp;query_ranges:&nbsp;Optional&nbsp;ranges&nbsp;for&nbsp;conditional&nbsp;search.<br>
&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;not&nbsp;specified,&nbsp;search&nbsp;whole&nbsp;table<br>
&nbsp;<br>
:type&nbsp;&nbsp;top_k:&nbsp;int<br>
:param&nbsp;top_k:&nbsp;how&nbsp;many&nbsp;similar&nbsp;vectors&nbsp;will&nbsp;be&nbsp;searched<br>
&nbsp;<br>
:returns<br>
&nbsp;&nbsp;&nbsp;&nbsp;Status:&nbsp;&nbsp;indicate&nbsp;if&nbsp;query&nbsp;is&nbsp;successful<br>
&nbsp;&nbsp;&nbsp;&nbsp;query_results:&nbsp;list[<a href="#TopKQueryResult">TopKQueryResult</a>]</tt></dd></dl>
<dl><dt><a name="ConnectIntf-server_status"><strong>server_status</strong></a>(self, cmd)</dt><dd><tt>Provide&nbsp;server&nbsp;status<br>
should&nbsp;be&nbsp;implemented<br>
:type&nbsp;cmd,&nbsp;str<br>
&nbsp;<br>
:return:&nbsp;str,&nbsp;server&nbsp;status</tt></dd></dl>
<dl><dt><a name="ConnectIntf-server_version"><strong>server_version</strong></a>(self)</dt><dd><tt>Provide&nbsp;server&nbsp;version<br>
should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:return:&nbsp;str,&nbsp;server&nbsp;version</tt></dd></dl>
<dl><dt><a name="ConnectIntf-show_tables"><strong>show_tables</strong></a>(self)</dt><dd><tt>Show&nbsp;all&nbsp;tables&nbsp;in&nbsp;database<br>
should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:return<br>
&nbsp;&nbsp;&nbsp;&nbsp;Status:&nbsp;indicate&nbsp;if&nbsp;this&nbsp;operation&nbsp;is&nbsp;successful<br>
&nbsp;&nbsp;&nbsp;&nbsp;tables:&nbsp;list[str],&nbsp;list&nbsp;of&nbsp;table&nbsp;names</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="IndexType">class <strong>IndexType</strong></a>(<a href="enum.html#IntEnum">enum.IntEnum</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>An&nbsp;enumeration.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="client.Abstract.html#IndexType">IndexType</a></dd>
<dd><a href="enum.html#IntEnum">enum.IntEnum</a></dd>
<dd><a href="builtins.html#int">builtins.int</a></dd>
<dd><a href="enum.html#Enum">enum.Enum</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>IDMAP</strong> = &lt;IndexType.IDMAP: 1&gt;</dl>
<dl><dt><strong>INVALIDE</strong> = &lt;IndexType.INVALIDE: 0&gt;</dl>
<dl><dt><strong>IVFLAT</strong> = &lt;IndexType.IVFLAT: 2&gt;</dl>
<hr>
Data descriptors inherited from <a href="enum.html#Enum">enum.Enum</a>:<br>
<dl><dt><strong>name</strong></dt>
<dd><tt>The&nbsp;name&nbsp;of&nbsp;the&nbsp;Enum&nbsp;member.</tt></dd>
</dl>
<dl><dt><strong>value</strong></dt>
<dd><tt>The&nbsp;value&nbsp;of&nbsp;the&nbsp;Enum&nbsp;member.</tt></dd>
</dl>
<hr>
Data descriptors inherited from <a href="enum.html#EnumMeta">enum.EnumMeta</a>:<br>
<dl><dt><strong>__members__</strong></dt>
<dd><tt>Returns&nbsp;a&nbsp;mapping&nbsp;of&nbsp;member&nbsp;name-&gt;value.<br>
&nbsp;<br>
This&nbsp;mapping&nbsp;lists&nbsp;all&nbsp;enum&nbsp;members,&nbsp;including&nbsp;aliases.&nbsp;Note&nbsp;that&nbsp;this<br>
is&nbsp;a&nbsp;read-only&nbsp;view&nbsp;of&nbsp;the&nbsp;internal&nbsp;mapping.</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="QueryResult">class <strong>QueryResult</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Query&nbsp;result<br>
&nbsp;<br>
:type&nbsp;&nbsp;id:&nbsp;int64<br>
:param&nbsp;id:&nbsp;id&nbsp;of&nbsp;the&nbsp;vector<br>
&nbsp;<br>
:type&nbsp;&nbsp;score:&nbsp;float<br>
:param&nbsp;score:&nbsp;Vector&nbsp;similarity&nbsp;0&nbsp;&lt;=&nbsp;score&nbsp;&lt;=&nbsp;100<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="QueryResult-__init__"><strong>__init__</strong></a>(self, id, score)</dt><dd><tt>Initialize&nbsp;self.&nbsp;&nbsp;See&nbsp;help(type(self))&nbsp;for&nbsp;accurate&nbsp;signature.</tt></dd></dl>
<dl><dt><a name="QueryResult-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return&nbsp;repr(self).</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Range">class <strong>Range</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#Range">Range</a>&nbsp;information<br>
&nbsp;<br>
:type&nbsp;&nbsp;start:&nbsp;str<br>
:param&nbsp;start:&nbsp;<a href="#Range">Range</a>&nbsp;start&nbsp;value<br>
&nbsp;<br>
:type&nbsp;&nbsp;end:&nbsp;str<br>
:param&nbsp;end:&nbsp;<a href="#Range">Range</a>&nbsp;end&nbsp;value<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Range-__init__"><strong>__init__</strong></a>(self, start, end)</dt><dd><tt>Initialize&nbsp;self.&nbsp;&nbsp;See&nbsp;help(type(self))&nbsp;for&nbsp;accurate&nbsp;signature.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="RowRecord">class <strong>RowRecord</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Record&nbsp;inserted<br>
&nbsp;<br>
:type&nbsp;&nbsp;vector_data:&nbsp;binary&nbsp;str<br>
:param&nbsp;vector_data:&nbsp;(Required)&nbsp;a&nbsp;vector<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="RowRecord-__init__"><strong>__init__</strong></a>(self, vector_data)</dt><dd><tt>Initialize&nbsp;self.&nbsp;&nbsp;See&nbsp;help(type(self))&nbsp;for&nbsp;accurate&nbsp;signature.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="TableSchema">class <strong>TableSchema</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Table&nbsp;Schema<br>
&nbsp;<br>
:type&nbsp;&nbsp;table_name:&nbsp;str<br>
:param&nbsp;table_name:&nbsp;(Required)&nbsp;name&nbsp;of&nbsp;table<br>
&nbsp;<br>
:type&nbsp;&nbsp;index_type:&nbsp;<a href="#IndexType">IndexType</a><br>
:param&nbsp;index_type:&nbsp;(Optional)&nbsp;index&nbsp;type,&nbsp;default&nbsp;=&nbsp;0<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;`<a href="#IndexType">IndexType</a>`:&nbsp;0-invalid,&nbsp;1-idmap,&nbsp;2-ivflat<br>
&nbsp;<br>
:type&nbsp;&nbsp;dimension:&nbsp;int64<br>
:param&nbsp;dimension:&nbsp;(Required)&nbsp;dimension&nbsp;of&nbsp;vector<br>
&nbsp;<br>
:type&nbsp;&nbsp;store_raw_vector:&nbsp;bool<br>
:param&nbsp;store_raw_vector:&nbsp;(Optional)&nbsp;default&nbsp;=&nbsp;False<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="TableSchema-__init__"><strong>__init__</strong></a>(self, table_name, dimension=0, index_type=&lt;IndexType.INVALIDE: 0&gt;, store_raw_vector=False)</dt><dd><tt>Initialize&nbsp;self.&nbsp;&nbsp;See&nbsp;help(type(self))&nbsp;for&nbsp;accurate&nbsp;signature.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="TopKQueryResult">class <strong>TopKQueryResult</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>TopK&nbsp;query&nbsp;results<br>
&nbsp;<br>
:type&nbsp;&nbsp;query_results:&nbsp;list[<a href="#QueryResult">QueryResult</a>]<br>
:param&nbsp;query_results:&nbsp;TopK&nbsp;query&nbsp;results<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="TopKQueryResult-__init__"><strong>__init__</strong></a>(self, query_results)</dt><dd><tt>Initialize&nbsp;self.&nbsp;&nbsp;See&nbsp;help(type(self))&nbsp;for&nbsp;accurate&nbsp;signature.</tt></dd></dl>
<dl><dt><a name="TopKQueryResult-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return&nbsp;repr(self).</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table>
</body></html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module Client</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>Client</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href="../..">index</a><br><a href="file:/home/yangxuan/vecwise_engine/python/sdk/client/Client.py">/home/yangxuan/vecwise_engine/python/sdk/client/Client.py</a></font></td></tr></table>
<p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="milvus.thrift.MilvusService.html">milvus.thrift.MilvusService</a><br>
<a href="thrift.protocol.TBinaryProtocol.html">thrift.protocol.TBinaryProtocol</a><br>
</td><td width="25%" valign=top><a href="thrift.transport.TSocket.html">thrift.transport.TSocket</a><br>
<a href="thrift.transport.TTransport.html">thrift.transport.TTransport</a><br>
</td><td width="25%" valign=top><a href="logging.html">logging</a><br>
<a href="milvus.thrift.ttypes.html">milvus.thrift.ttypes</a><br>
</td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="client.Client.html#Prepare">Prepare</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="client.Abstract.html#ConnectIntf">client.Abstract.ConnectIntf</a>(<a href="builtins.html#object">builtins.object</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="client.Client.html#Milvus">Milvus</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Milvus">class <strong>Milvus</strong></a>(<a href="client.Abstract.html#ConnectIntf">client.Abstract.ConnectIntf</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>SDK&nbsp;client&nbsp;abstract&nbsp;class<br>
&nbsp;<br>
Connection&nbsp;is&nbsp;a&nbsp;abstract&nbsp;class<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="client.Client.html#Milvus">Milvus</a></dd>
<dd><a href="client.Abstract.html#ConnectIntf">client.Abstract.ConnectIntf</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="Milvus-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>Initialize&nbsp;self.&nbsp;&nbsp;See&nbsp;help(type(self))&nbsp;for&nbsp;accurate&nbsp;signature.</tt></dd></dl>
<dl><dt><a name="Milvus-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return&nbsp;repr(self).</tt></dd></dl>
<dl><dt><a name="Milvus-add_vectors"><strong>add_vectors</strong></a>(self, table_name, records)</dt><dd><tt>Add&nbsp;vectors&nbsp;to&nbsp;table<br>
&nbsp;<br>
:param&nbsp;table_name:&nbsp;table&nbsp;name&nbsp;been&nbsp;inserted<br>
:param&nbsp;records:&nbsp;List[RowRecord],&nbsp;list&nbsp;of&nbsp;vectors&nbsp;been&nbsp;inserted<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`Please&nbsp;use&nbsp;<a href="#Prepare">Prepare</a>.row_record&nbsp;generate&nbsp;records`<br>
&nbsp;<br>
:returns:<br>
&nbsp;&nbsp;&nbsp;&nbsp;Status&nbsp;:&nbsp;indicate&nbsp;if&nbsp;vectors&nbsp;inserted&nbsp;successfully<br>
&nbsp;&nbsp;&nbsp;&nbsp;ids&nbsp;:list&nbsp;of&nbsp;id,&nbsp;after&nbsp;inserted&nbsp;every&nbsp;vector&nbsp;is&nbsp;given&nbsp;a&nbsp;id</tt></dd></dl>
<dl><dt><a name="Milvus-client_version"><strong>client_version</strong></a>(self)</dt><dd><tt>Provide&nbsp;client&nbsp;version<br>
&nbsp;<br>
:return:&nbsp;Client&nbsp;version</tt></dd></dl>
<dl><dt><a name="Milvus-connect"><strong>connect</strong></a>(self, host='localhost', port='9090', uri=None)</dt><dd><tt>Connect&nbsp;method&nbsp;should&nbsp;be&nbsp;called&nbsp;before&nbsp;any&nbsp;operations<br>
Server&nbsp;will&nbsp;be&nbsp;connected&nbsp;after&nbsp;connect&nbsp;return&nbsp;OK<br>
Should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:type&nbsp;&nbsp;host:&nbsp;str<br>
:param&nbsp;host:&nbsp;host<br>
&nbsp;<br>
:type&nbsp;&nbsp;port:&nbsp;str<br>
:param&nbsp;port:&nbsp;port<br>
&nbsp;<br>
:type&nbsp;&nbsp;uri:&nbsp;str<br>
:param&nbsp;uri:&nbsp;(Optional)&nbsp;uri<br>
&nbsp;<br>
:return&nbsp;Status,&nbsp;&nbsp;indicate&nbsp;if&nbsp;connect&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="Milvus-create_table"><strong>create_table</strong></a>(self, param)</dt><dd><tt>Create&nbsp;table<br>
&nbsp;<br>
:param&nbsp;param:&nbsp;Provide&nbsp;table&nbsp;information&nbsp;to&nbsp;be&nbsp;created,<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`Please&nbsp;use&nbsp;<a href="#Prepare">Prepare</a>.table_schema&nbsp;generate&nbsp;param`<br>
&nbsp;<br>
:return:&nbsp;Status,&nbsp;indicate&nbsp;if&nbsp;operation&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="Milvus-delete_table"><strong>delete_table</strong></a>(self, table_name)</dt><dd><tt>Delete&nbsp;table<br>
&nbsp;<br>
:param&nbsp;table_name:&nbsp;Name&nbsp;of&nbsp;the&nbsp;table&nbsp;being&nbsp;deleted<br>
&nbsp;<br>
:return:&nbsp;Status,&nbsp;indicate&nbsp;if&nbsp;operation&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="Milvus-describe_table"><strong>describe_table</strong></a>(self, table_name)</dt><dd><tt>Show&nbsp;table&nbsp;information<br>
&nbsp;<br>
:param&nbsp;table_name:&nbsp;str,&nbsp;which&nbsp;table&nbsp;to&nbsp;be&nbsp;shown<br>
&nbsp;<br>
:returns:<br>
&nbsp;&nbsp;&nbsp;&nbsp;Status:&nbsp;indicate&nbsp;if&nbsp;query&nbsp;is&nbsp;successful<br>
&nbsp;&nbsp;&nbsp;&nbsp;table_schema:&nbsp;TableSchema,&nbsp;return&nbsp;when&nbsp;operation&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="Milvus-disconnect"><strong>disconnect</strong></a>(self)</dt><dd><tt>Disconnect,&nbsp;server&nbsp;will&nbsp;be&nbsp;disconnected&nbsp;after&nbsp;disconnect&nbsp;return&nbsp;SUCCESS<br>
Should&nbsp;be&nbsp;implemented<br>
&nbsp;<br>
:return&nbsp;Status,&nbsp;&nbsp;indicate&nbsp;if&nbsp;connect&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="Milvus-get_table_row_count"><strong>get_table_row_count</strong></a>(self, table_name)</dt><dd><tt>Get&nbsp;table&nbsp;row&nbsp;count<br>
&nbsp;<br>
:type&nbsp;&nbsp;table_name,&nbsp;str<br>
:param&nbsp;table_name,&nbsp;target&nbsp;table&nbsp;name.<br>
&nbsp;<br>
:returns:<br>
&nbsp;&nbsp;&nbsp;&nbsp;Status:&nbsp;indicate&nbsp;if&nbsp;operation&nbsp;is&nbsp;successful<br>
&nbsp;&nbsp;&nbsp;&nbsp;res:&nbsp;int,&nbsp;table&nbsp;row&nbsp;count</tt></dd></dl>
<dl><dt><a name="Milvus-search_vectors"><strong>search_vectors</strong></a>(self, table_name, top_k, query_records, query_ranges=None)</dt><dd><tt>Query&nbsp;vectors&nbsp;in&nbsp;a&nbsp;table<br>
&nbsp;<br>
:param&nbsp;table_name:&nbsp;str,&nbsp;table&nbsp;name&nbsp;been&nbsp;queried<br>
:param&nbsp;query_records:&nbsp;list[QueryRecord],&nbsp;all&nbsp;vectors&nbsp;going&nbsp;to&nbsp;be&nbsp;queried<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`Please&nbsp;use&nbsp;<a href="#Prepare">Prepare</a>.query_record&nbsp;generate&nbsp;QueryRecord`<br>
&nbsp;<br>
:param&nbsp;top_k:&nbsp;int,&nbsp;how&nbsp;many&nbsp;similar&nbsp;vectors&nbsp;will&nbsp;be&nbsp;searched<br>
:param&nbsp;query_ranges,&nbsp;(Optional)&nbsp;list[Range],&nbsp;search&nbsp;range<br>
&nbsp;<br>
:returns:<br>
&nbsp;&nbsp;&nbsp;&nbsp;Status:&nbsp;&nbsp;indicate&nbsp;if&nbsp;query&nbsp;is&nbsp;successful<br>
&nbsp;&nbsp;&nbsp;&nbsp;res:&nbsp;list[TopKQueryResult],&nbsp;return&nbsp;when&nbsp;operation&nbsp;is&nbsp;successful</tt></dd></dl>
<dl><dt><a name="Milvus-server_status"><strong>server_status</strong></a>(self, cmd=None)</dt><dd><tt>Provide&nbsp;server&nbsp;status<br>
&nbsp;<br>
:return:&nbsp;Server&nbsp;status</tt></dd></dl>
<dl><dt><a name="Milvus-server_version"><strong>server_version</strong></a>(self)</dt><dd><tt>Provide&nbsp;server&nbsp;version<br>
&nbsp;<br>
:return:&nbsp;Server&nbsp;version</tt></dd></dl>
<dl><dt><a name="Milvus-show_tables"><strong>show_tables</strong></a>(self)</dt><dd><tt>Show&nbsp;all&nbsp;tables&nbsp;in&nbsp;database<br>
&nbsp;<br>
:return:<br>
&nbsp;&nbsp;&nbsp;&nbsp;Status:&nbsp;indicate&nbsp;if&nbsp;this&nbsp;operation&nbsp;is&nbsp;successful<br>
&nbsp;&nbsp;&nbsp;&nbsp;tables:&nbsp;list[str],&nbsp;list&nbsp;of&nbsp;table&nbsp;names,&nbsp;return&nbsp;when&nbsp;operation<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;successful</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>connected</strong></dt>
</dl>
<hr>
Data descriptors inherited from <a href="client.Abstract.html#ConnectIntf">client.Abstract.ConnectIntf</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Prepare">class <strong>Prepare</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Class methods defined here:<br>
<dl><dt><a name="Prepare-range"><strong>range</strong></a>(start, end)<font color="#909090"><font face="helvetica, arial"> from <a href="builtins.html#type">builtins.type</a></font></font></dt><dd><tt>:param&nbsp;start:&nbsp;str,&nbsp;(Required)&nbsp;range&nbsp;start<br>
:param&nbsp;end:&nbsp;str&nbsp;(Required)&nbsp;range&nbsp;end<br>
&nbsp;<br>
:return&nbsp;Range</tt></dd></dl>
<dl><dt><a name="Prepare-row_record"><strong>row_record</strong></a>(vector_data)<font color="#909090"><font face="helvetica, arial"> from <a href="builtins.html#type">builtins.type</a></font></font></dt><dd><tt>Record&nbsp;inserted<br>
&nbsp;<br>
:param&nbsp;vector_data:&nbsp;float&nbsp;binary&nbsp;str,&nbsp;(Required)&nbsp;a&nbsp;binary&nbsp;str</tt></dd></dl>
<dl><dt><a name="Prepare-table_schema"><strong>table_schema</strong></a>(table_name, dimension, index_type=&lt;IndexType.INVALIDE: 0&gt;, store_raw_vector=False)<font color="#909090"><font face="helvetica, arial"> from <a href="builtins.html#type">builtins.type</a></font></font></dt><dd><tt>:param&nbsp;table_name:&nbsp;str,&nbsp;(Required)&nbsp;name&nbsp;of&nbsp;table<br>
:param&nbsp;index_type:&nbsp;IndexType,&nbsp;(Required)&nbsp;index&nbsp;type,&nbsp;default&nbsp;=&nbsp;IndexType.INVALID<br>
:param&nbsp;dimension:&nbsp;int64,&nbsp;(Optional)&nbsp;dimension&nbsp;of&nbsp;the&nbsp;table<br>
:param&nbsp;store_raw_vector:&nbsp;bool,&nbsp;(Optional)&nbsp;default&nbsp;=&nbsp;False<br>
&nbsp;<br>
:return:&nbsp;TableSchema</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>LOGGER</strong> = &lt;Logger Client (WARNING)&gt;<br>
<strong>__NAME__</strong> = 'Thrift_Client'<br>
<strong>__VERSION__</strong> = '0.0.1'</td></tr></table>
</body></html>
\ No newline at end of file
此差异已折叠。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module Status</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>Status</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href="../..">index</a><br><a href="file:/home/yangxuan/vecwise_engine/python/sdk/client/Status.py">/home/yangxuan/vecwise_engine/python/sdk/client/Status.py</a></font></td></tr></table>
<p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="client.Status.html#Status">Status</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Status">class <strong>Status</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>:attribute&nbsp;code&nbsp;:&nbsp;int&nbsp;(optional)&nbsp;default&nbsp;as&nbsp;ok<br>
:attribute&nbsp;message&nbsp;:&nbsp;str&nbsp;(optional)&nbsp;current&nbsp;status&nbsp;message<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Status-__eq__"><strong>__eq__</strong></a>(self, other)</dt><dd><tt>Make&nbsp;<a href="#Status">Status</a>&nbsp;comparable&nbsp;with&nbsp;self&nbsp;by&nbsp;code</tt></dd></dl>
<dl><dt><a name="Status-__init__"><strong>__init__</strong></a>(self, code=0, message=None)</dt><dd><tt>Initialize&nbsp;self.&nbsp;&nbsp;See&nbsp;help(type(self))&nbsp;for&nbsp;accurate&nbsp;signature.</tt></dd></dl>
<dl><dt><a name="Status-__ne__"><strong>__ne__</strong></a>(self, other)</dt><dd><tt>Return&nbsp;self!=value.</tt></dd></dl>
<dl><dt><a name="Status-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return&nbsp;repr(self).</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>CONNECT_FAILED</strong> = 1</dl>
<dl><dt><strong>ILLEGAL_ARGUMENT</strong> = 4</dl>
<dl><dt><strong>ILLEGAL_DIMENSION</strong> = 6</dl>
<dl><dt><strong>ILLEGAL_RANGE</strong> = 5</dl>
<dl><dt><strong>PERMISSION_DENIED</strong> = 2</dl>
<dl><dt><strong>SUCCESS</strong> = 0</dl>
<dl><dt><strong>TABLE_NOT_EXISTS</strong> = 3</dl>
<dl><dt><strong>__hash__</strong> = None</dl>
</td></tr></table></td></tr></table>
</body></html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: package client</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>client</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href="../..">index</a><br><a href="file:/home/yangxuan/vecwise_engine/python/sdk/client/__init__.py">/home/yangxuan/vecwise_engine/python/sdk/client/__init__.py</a></font></td></tr></table>
<p><tt>client&nbsp;module</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="client.Abstract.html">Abstract</a><br>
</td><td width="25%" valign=top><a href="client.Client.html">Client</a><br>
</td><td width="25%" valign=top><a href="client.Exceptions.html">Exceptions</a><br>
</td><td width="25%" valign=top><a href="client.Status.html">Status</a><br>
</td></tr></table></td></tr></table>
</body></html>
\ No newline at end of file
......@@ -11,7 +11,7 @@ def main():
# Connect
# Please change HOST and PORT to correct one
param = {'host': 'HOST', 'port': 'PORT'}
param = {'host': '192.168.1.121', 'port': '33001'}
cnn_status = milvus.connect(**param)
print('# Connect Status: {}'.format(cnn_status))
......@@ -22,29 +22,44 @@ def main():
# Get server version
print('# Server version: {}'.format(milvus.server_version()))
# Show tables and their description
status, tables = milvus.show_tables()
print('# Show tables: {}'.format(tables))
# Create table
# 01.Prepare data
param = {
'table_name': 'test'+ str(random.randint(0,999)),
'dimension': 256,
'index_type': IndexType.IDMAP,
'store_raw_vector': False
}
# 02.Create table
res_status = milvus.create_table(Prepare.table_schema(**param))
print('# Create table status: {}'.format(res_status))
# Describe table
# Check if `test01` exists, if not, create a table test01
table_name = 'test01'
res_status, table = milvus.describe_table(table_name)
print('# Describe table status: {}'.format(res_status))
print('# Describe table:{}'.format(table))
# Create table
# 01.Prepare data
if not table:
param = {
'table_name': 'test01',
'dimension': 256,
'index_type': IndexType.IDMAP,
'store_raw_vector': False
}
# 02.Create table
res_status = milvus.create_table(Prepare.table_schema(**param))
print('# Create table status: {}'.format(res_status))
# # Create table Optional
# # 01.Prepare data
# param = {
# 'table_name': 'test'+ str(random.randint(22,999)),
# 'dimension': 256,
# 'index_type': IndexType.IDMAP,
# 'store_raw_vector': False
# }
#
# # 02.Create table
# res_status = milvus.create_table(Prepare.table_schema(**param))
# print('# Create table status: {}'.format(res_status))
# Show tables and their description
status, tables = milvus.show_tables()
print('# Show tables: {}'.format(tables))
# Add vectors to table 'test01'
# 01. Prepare data
dim = 256
......@@ -58,6 +73,12 @@ def main():
pprint(ids)
# Search vectors
# When adding vectors for the first time, server will take at least 5s to
# persist vector data, so we have wait for 6s to search correctly
import time
print('Waiting for 6s...')
time.sleep(6) # Wait for server persist vector data
q_records = [Prepare.row_record(struct.pack(str(dim) + 'd',
*[random.random() for _ in range(dim)]))
for _ in range(5)]
......@@ -65,7 +86,7 @@ def main():
'table_name': 'test01',
'query_records': q_records,
'top_k': 10,
# 'query_ranges': None # Optional
# 'query_ranges': # Optional
}
sta, results = milvus.search_vectors(**param)
print('# Search vectors status: {}'.format(sta))
......@@ -76,10 +97,6 @@ def main():
print('# Status: {}'.format(sta))
print('# Count: {}'.format(result))
# Delete table 'test01'
res_status = milvus.delete_table(table_name)
print('# Delete table status: {}'.format(res_status))
# Disconnect
discnn_status = milvus.disconnect()
print('# Disconnect Status: {}'.format(discnn_status))
......
......@@ -3,11 +3,11 @@ import setuptools
long_description = ''
setuptools.setup(
name="MegaSearch",
version="0.0.1",
name="Milvus",
version="0.1.0",
author="XuanYang",
author_email="xuan.yang@zilliz.com",
description="Sdk for using MegaSearch",
description="Python Sdk for Milvus",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3.4",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册