提交 2a027bff 编写于 作者: Y Yang Xuan

edit(python): change name to milvus


Former-commit-id: 35bf1219af291c16b31c23d017e1d5d4b8a136f2
上级 50003059
......@@ -5,8 +5,8 @@ from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift.Thrift import TException, TApplicationException
from megasearch.thrift import MegasearchService
from megasearch.thrift import ttypes
from milvus.thrift import MilvusService
from milvus.thrift import ttypes
from client.Abstract import (
ConnectIntf,
TableSchema,
......@@ -77,7 +77,7 @@ class Prepare(object):
return ttypes.RowRecord(vector_data=temp.vector_data)
class MegaSearch(ConnectIntf):
class Milvus(ConnectIntf):
def __init__(self):
self.status = None
......@@ -95,7 +95,7 @@ class MegaSearch(ConnectIntf):
transport = TSocket.TSocket(host=host, port=port)
self._transport = TTransport.TBufferedTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
self._client = MegasearchService.Client(protocol)
self._client = MilvusService.Client(protocol)
try:
transport.open()
......
<!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
from client.Client import MegaSearch, Prepare, IndexType
from client.Client import Milvus, Prepare, IndexType
import random
import struct
from pprint import pprint
......@@ -6,24 +6,24 @@ from pprint import pprint
def main():
# Get client version
mega = MegaSearch()
print('# Client version: {}'.format(mega.client_version()))
milvus = Milvus()
print('# Client version: {}'.format(milvus.client_version()))
# Connect
# Please change HOST and PORT to correct one
param = {'host': 'HOST', 'port': 'PORT'}
cnn_status = mega.connect(**param)
cnn_status = milvus.connect(**param)
print('# Connect Status: {}'.format(cnn_status))
# Check if connected
is_connected = mega.connected
is_connected = milvus.connected
print('# Is connected: {}'.format(is_connected))
# Get server version
print('# Server version: {}'.format(mega.server_version()))
print('# Server version: {}'.format(milvus.server_version()))
# Show tables and their description
status, tables = mega.show_tables()
status, tables = milvus.show_tables()
print('# Show tables: {}'.format(tables))
# Create table
......@@ -36,12 +36,12 @@ def main():
}
# 02.Create table
res_status = mega.create_table(Prepare.table_schema(**param))
res_status = milvus.create_table(Prepare.table_schema(**param))
print('# Create table status: {}'.format(res_status))
# Describe table
table_name = 'test01'
res_status, table = mega.describe_table(table_name)
res_status, table = milvus.describe_table(table_name)
print('# Describe table status: {}'.format(res_status))
print('# Describe table:{}'.format(table))
......@@ -53,7 +53,7 @@ def main():
*[random.random()for _ in range(dim)]))
for _ in range(20)]
# 02. Add vectors
status, ids = mega.add_vectors(table_name=table_name, records=vectors)
status, ids = milvus.add_vectors(table_name=table_name, records=vectors)
print('# Add vector status: {}'.format(status))
pprint(ids)
......@@ -67,21 +67,21 @@ def main():
'top_k': 10,
# 'query_ranges': None # Optional
}
sta, results = mega.search_vectors(**param)
sta, results = milvus.search_vectors(**param)
print('# Search vectors status: {}'.format(sta))
pprint(results)
# Get table row count
sta, result = mega.get_table_row_count(table_name)
sta, result = milvus.get_table_row_count(table_name)
print('# Status: {}'.format(sta))
print('# Count: {}'.format(result))
# Delete table 'test01'
res_status = mega.delete_table(table_name)
res_status = milvus.delete_table(table_name)
print('# Delete table status: {}'.format(res_status))
# Disconnect
discnn_status = mega.disconnect()
discnn_status = milvus.disconnect()
print('# Disconnect Status: {}'.format(discnn_status))
......
#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.12.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
import sys
import pprint
if sys.version_info[0] > 2:
from urllib.parse import urlparse
else:
from urlparse import urlparse
from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
from milvus.thrift import MilvusService
from milvus.thrift.ttypes import *
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print('')
print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]')
print('')
print('Functions:')
print(' void CreateTable(TableSchema param)')
print(' void DeleteTable(string table_name)')
print(' AddVector(string table_name, record_array)')
print(' SearchVector(string table_name, query_record_array, query_range_array, i64 topk)')
print(' TableSchema DescribeTable(string table_name)')
print(' i64 GetTableRowCount(string table_name)')
print(' ShowTables()')
print(' string Ping(string cmd)')
print('')
sys.exit(0)
pp = pprint.PrettyPrinter(indent=2)
host = 'localhost'
port = 9090
uri = ''
framed = False
ssl = False
validate = True
ca_certs = None
keyfile = None
certfile = None
http = False
argi = 1
if sys.argv[argi] == '-h':
parts = sys.argv[argi + 1].split(':')
host = parts[0]
if len(parts) > 1:
port = int(parts[1])
argi += 2
if sys.argv[argi] == '-u':
url = urlparse(sys.argv[argi + 1])
parts = url[1].split(':')
host = parts[0]
if len(parts) > 1:
port = int(parts[1])
else:
port = 80
uri = url[2]
if url[4]:
uri += '?%s' % url[4]
http = True
argi += 2
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
framed = True
argi += 1
if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl':
ssl = True
argi += 1
if sys.argv[argi] == '-novalidate':
validate = False
argi += 1
if sys.argv[argi] == '-ca_certs':
ca_certs = sys.argv[argi+1]
argi += 2
if sys.argv[argi] == '-keyfile':
keyfile = sys.argv[argi+1]
argi += 2
if sys.argv[argi] == '-certfile':
certfile = sys.argv[argi+1]
argi += 2
cmd = sys.argv[argi]
args = sys.argv[argi + 1:]
if http:
transport = THttpClient.THttpClient(host, port, uri)
else:
if ssl:
socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile)
else:
socket = TSocket.TSocket(host, port)
if framed:
transport = TTransport.TFramedTransport(socket)
else:
transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol(transport)
client = MilvusService.Client(protocol)
transport.open()
if cmd == 'CreateTable':
if len(args) != 1:
print('CreateTable requires 1 args')
sys.exit(1)
pp.pprint(client.CreateTable(eval(args[0]),))
elif cmd == 'DeleteTable':
if len(args) != 1:
print('DeleteTable requires 1 args')
sys.exit(1)
pp.pprint(client.DeleteTable(args[0],))
elif cmd == 'AddVector':
if len(args) != 2:
print('AddVector requires 2 args')
sys.exit(1)
pp.pprint(client.AddVector(args[0], eval(args[1]),))
elif cmd == 'SearchVector':
if len(args) != 4:
print('SearchVector requires 4 args')
sys.exit(1)
pp.pprint(client.SearchVector(args[0], eval(args[1]), eval(args[2]), eval(args[3]),))
elif cmd == 'DescribeTable':
if len(args) != 1:
print('DescribeTable requires 1 args')
sys.exit(1)
pp.pprint(client.DescribeTable(args[0],))
elif cmd == 'GetTableRowCount':
if len(args) != 1:
print('GetTableRowCount requires 1 args')
sys.exit(1)
pp.pprint(client.GetTableRowCount(args[0],))
elif cmd == 'ShowTables':
if len(args) != 0:
print('ShowTables requires 0 args')
sys.exit(1)
pp.pprint(client.ShowTables())
elif cmd == 'Ping':
if len(args) != 1:
print('Ping requires 1 args')
sys.exit(1)
pp.pprint(client.Ping(args[0],))
else:
print('Unrecognized method %s' % cmd)
sys.exit(1)
transport.close()
此差异已折叠。
__all__ = ['ttypes', 'constants', 'MilvusService.py']
#
# Autogenerated by Thrift Compiler (0.12.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec
import sys
from .ttypes import *
#
# Autogenerated by Thrift Compiler (0.12.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec
import sys
from thrift.transport import TTransport
all_structs = []
class ErrorCode(object):
SUCCESS = 0
CONNECT_FAILED = 1
PERMISSION_DENIED = 2
TABLE_NOT_EXISTS = 3
ILLEGAL_ARGUMENT = 4
ILLEGAL_RANGE = 5
ILLEGAL_DIMENSION = 6
_VALUES_TO_NAMES = {
0: "SUCCESS",
1: "CONNECT_FAILED",
2: "PERMISSION_DENIED",
3: "TABLE_NOT_EXISTS",
4: "ILLEGAL_ARGUMENT",
5: "ILLEGAL_RANGE",
6: "ILLEGAL_DIMENSION",
}
_NAMES_TO_VALUES = {
"SUCCESS": 0,
"CONNECT_FAILED": 1,
"PERMISSION_DENIED": 2,
"TABLE_NOT_EXISTS": 3,
"ILLEGAL_ARGUMENT": 4,
"ILLEGAL_RANGE": 5,
"ILLEGAL_DIMENSION": 6,
}
class Exception(TException):
"""
Attributes:
- code
- reason
"""
def __init__(self, code=None, reason=None,):
self.code = code
self.reason = reason
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.code = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.reason = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('Exception')
if self.code is not None:
oprot.writeFieldBegin('code', TType.I32, 1)
oprot.writeI32(self.code)
oprot.writeFieldEnd()
if self.reason is not None:
oprot.writeFieldBegin('reason', TType.STRING, 2)
oprot.writeString(self.reason.encode('utf-8') if sys.version_info[0] == 2 else self.reason)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __str__(self):
return repr(self)
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class TableSchema(object):
"""
@brief Table Schema
Attributes:
- table_name
- index_type
- dimension
- store_raw_vector
"""
def __init__(self, table_name=None, index_type=0, dimension=0, store_raw_vector=False,):
self.table_name = table_name
self.index_type = index_type
self.dimension = dimension
self.store_raw_vector = store_raw_vector
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.table_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.index_type = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I64:
self.dimension = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.BOOL:
self.store_raw_vector = iprot.readBool()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('TableSchema')
if self.table_name is not None:
oprot.writeFieldBegin('table_name', TType.STRING, 1)
oprot.writeString(self.table_name.encode('utf-8') if sys.version_info[0] == 2 else self.table_name)
oprot.writeFieldEnd()
if self.index_type is not None:
oprot.writeFieldBegin('index_type', TType.I32, 2)
oprot.writeI32(self.index_type)
oprot.writeFieldEnd()
if self.dimension is not None:
oprot.writeFieldBegin('dimension', TType.I64, 3)
oprot.writeI64(self.dimension)
oprot.writeFieldEnd()
if self.store_raw_vector is not None:
oprot.writeFieldBegin('store_raw_vector', TType.BOOL, 4)
oprot.writeBool(self.store_raw_vector)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.table_name is None:
raise TProtocolException(message='Required field table_name is unset!')
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Range(object):
"""
@brief Range Schema
Attributes:
- start_value
- end_value
"""
def __init__(self, start_value=None, end_value=None,):
self.start_value = start_value
self.end_value = end_value
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.start_value = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.end_value = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('Range')
if self.start_value is not None:
oprot.writeFieldBegin('start_value', TType.STRING, 1)
oprot.writeString(self.start_value.encode('utf-8') if sys.version_info[0] == 2 else self.start_value)
oprot.writeFieldEnd()
if self.end_value is not None:
oprot.writeFieldBegin('end_value', TType.STRING, 2)
oprot.writeString(self.end_value.encode('utf-8') if sys.version_info[0] == 2 else self.end_value)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RowRecord(object):
"""
@brief Record inserted
Attributes:
- vector_data
"""
def __init__(self, vector_data=None,):
self.vector_data = vector_data
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.vector_data = iprot.readBinary()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('RowRecord')
if self.vector_data is not None:
oprot.writeFieldBegin('vector_data', TType.STRING, 1)
oprot.writeBinary(self.vector_data)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.vector_data is None:
raise TProtocolException(message='Required field vector_data is unset!')
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class QueryResult(object):
"""
@brief Query result
Attributes:
- id
- score
"""
def __init__(self, id=None, score=None,):
self.id = id
self.score = score
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I64:
self.id = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.DOUBLE:
self.score = iprot.readDouble()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('QueryResult')
if self.id is not None:
oprot.writeFieldBegin('id', TType.I64, 1)
oprot.writeI64(self.id)
oprot.writeFieldEnd()
if self.score is not None:
oprot.writeFieldBegin('score', TType.DOUBLE, 2)
oprot.writeDouble(self.score)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class TopKQueryResult(object):
"""
@brief TopK query result
Attributes:
- query_result_arrays
"""
def __init__(self, query_result_arrays=None,):
self.query_result_arrays = query_result_arrays
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.LIST:
self.query_result_arrays = []
(_etype3, _size0) = iprot.readListBegin()
for _i4 in range(_size0):
_elem5 = QueryResult()
_elem5.read(iprot)
self.query_result_arrays.append(_elem5)
iprot.readListEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('TopKQueryResult')
if self.query_result_arrays is not None:
oprot.writeFieldBegin('query_result_arrays', TType.LIST, 1)
oprot.writeListBegin(TType.STRUCT, len(self.query_result_arrays))
for iter6 in self.query_result_arrays:
iter6.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(Exception)
Exception.thrift_spec = (
None, # 0
(1, TType.I32, 'code', None, None, ), # 1
(2, TType.STRING, 'reason', 'UTF8', None, ), # 2
)
all_structs.append(TableSchema)
TableSchema.thrift_spec = (
None, # 0
(1, TType.STRING, 'table_name', 'UTF8', None, ), # 1
(2, TType.I32, 'index_type', None, 0, ), # 2
(3, TType.I64, 'dimension', None, 0, ), # 3
(4, TType.BOOL, 'store_raw_vector', None, False, ), # 4
)
all_structs.append(Range)
Range.thrift_spec = (
None, # 0
(1, TType.STRING, 'start_value', 'UTF8', None, ), # 1
(2, TType.STRING, 'end_value', 'UTF8', None, ), # 2
)
all_structs.append(RowRecord)
RowRecord.thrift_spec = (
None, # 0
(1, TType.STRING, 'vector_data', 'BINARY', None, ), # 1
)
all_structs.append(QueryResult)
QueryResult.thrift_spec = (
None, # 0
(1, TType.I64, 'id', None, None, ), # 1
(2, TType.DOUBLE, 'score', None, None, ), # 2
)
all_structs.append(TopKQueryResult)
TopKQueryResult.thrift_spec = (
None, # 0
(1, TType.LIST, 'query_result_arrays', (TType.STRUCT, [QueryResult, None], False), None, ), # 1
)
fix_spec(all_structs)
del all_structs
......@@ -6,14 +6,14 @@ import random
import struct
from faker.providers import BaseProvider
from client.Client import MegaSearch, Prepare
from client.Client import Milvus, Prepare
from client.Abstract import IndexType, TableSchema
from client.Status import Status
from client.Exceptions import (
RepeatingConnectError,
DisconnectNotConnectedClientError
)
from megasearch.thrift import ttypes, MegasearchService
from milvus.thrift import ttypes, MilvusService
from thrift.transport.TSocket import TSocket
from thrift.transport import TTransport
......@@ -77,7 +77,7 @@ class TestConnection:
@mock.patch.object(TSocket, 'open')
def test_true_connect(self, open):
open.return_value = None
cnn = MegaSearch()
cnn = Milvus()
cnn.connect(**self.param)
assert cnn.status == Status.SUCCESS
......@@ -88,7 +88,7 @@ class TestConnection:
cnn.connect()
def test_false_connect(self):
cnn = MegaSearch()
cnn = Milvus()
cnn.connect(**self.param)
assert cnn.status != Status.SUCCESS
......@@ -99,13 +99,13 @@ class TestConnection:
close.return_value = None
open.return_value = None
cnn = MegaSearch()
cnn = Milvus()
cnn.connect(**self.param)
assert cnn.disconnect() == Status.SUCCESS
def test_disconnected_error(self):
cnn = MegaSearch()
cnn = Milvus()
cnn.connect_status = Status(Status.PERMISSION_DENIED)
with pytest.raises(DisconnectNotConnectedClientError):
cnn.disconnect()
......@@ -119,11 +119,11 @@ class TestTable:
param = {'host': 'localhost', 'port': '5000'}
open.return_value = None
cnn = MegaSearch()
cnn = Milvus()
cnn.connect(**param)
return cnn
@mock.patch.object(MegasearchService.Client, 'CreateTable')
@mock.patch.object(MilvusService.Client, 'CreateTable')
def test_create_table(self, CreateTable, client):
CreateTable.return_value = None
......@@ -138,7 +138,7 @@ class TestTable:
LOGGER.error('{}'.format(res))
assert res != Status.SUCCESS
@mock.patch.object(MegasearchService.Client, 'DeleteTable')
@mock.patch.object(MilvusService.Client, 'DeleteTable')
def test_delete_table(self, DeleteTable, client):
DeleteTable.return_value = None
table_name = 'fake_table_name'
......@@ -159,11 +159,11 @@ class TestVector:
param = {'host': 'localhost', 'port': '5000'}
open.return_value = None
cnn = MegaSearch()
cnn = Milvus()
cnn.connect(**param)
return cnn
@mock.patch.object(MegasearchService.Client, 'AddVector')
@mock.patch.object(MilvusService.Client, 'AddVector')
def test_add_vector(self, AddVector, client):
AddVector.return_value = None
......@@ -182,7 +182,7 @@ class TestVector:
res, ids = client.add_vectors(**param)
assert res != Status.SUCCESS
@mock.patch.object(MegasearchService.Client, 'SearchVector')
@mock.patch.object(MilvusService.Client, 'SearchVector')
def test_search_vector(self, SearchVector, client):
SearchVector.return_value = None, None
param = {
......@@ -204,7 +204,7 @@ class TestVector:
res, results = client.search_vectors(**param)
assert res != Status.SUCCESS
@mock.patch.object(MegasearchService.Client, 'DescribeTable')
@mock.patch.object(MilvusService.Client, 'DescribeTable')
def test_describe_table(self, DescribeTable, client):
DescribeTable.return_value = table_schema_factory()
......@@ -219,7 +219,7 @@ class TestVector:
assert res != Status.SUCCESS
assert not table_schema
@mock.patch.object(MegasearchService.Client, 'ShowTables')
@mock.patch.object(MilvusService.Client, 'ShowTables')
def test_show_tables(self, ShowTables, client):
ShowTables.return_value = [fake.table_name() for _ in range(10)], None
res, tables = client.show_tables()
......@@ -231,7 +231,7 @@ class TestVector:
assert res != Status.SUCCESS
assert not tables
@mock.patch.object(MegasearchService.Client, 'GetTableRowCount')
@mock.patch.object(MilvusService.Client, 'GetTableRowCount')
def test_get_table_row_count(self, GetTableRowCount, client):
GetTableRowCount.return_value = 22, None
res, count = client.get_table_row_count('fake_table')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册