
    j,z                         d dl mZmZmZmZmZ d dlZd dlZd dl	m
Z
 d dlmZmZ d dlmZ d dlmZ ddlmZ  ed	          Z ed
          Z G d d
          ZdS )    )DictListOptionalTypeVarUnionN)utils)
BaseRankerSearchResult)Replica)MilvusException   )MutationResult
Collection	Partitionc                      e Zd Z	 d&deeef         dededefdZdefdZd Z	e
defd	            Ze
defd
            Ze
defd            Ze
defd            Zd'dee         fdZd'dee         fdZd(dedee         fdZd'dee         fdZ	 d'deeej        ej        f         dee         defdZd'dedee         fdZ	 d'deeej        ej        f         dee         defdZ	 	 	 	 d)deeej        f         dede dedee         deee                  dee         dede!fd Z"	 	 	 d*d!ed"e#dedeee                  dee         defd#Z$	 	 d+dedeee                  dee         fd$Z%d'dee         de&fd%Z'dS ),r    
collectionnamedescriptionreturnc                    ddl m} t          ||          r|| _        n8t          |t                    r ||          | _        nd}t          |          || _        || _        |                    dd          rd S  | j        j	        | j
        fi |s4|                                 } |j        | j        j
        | j
        fi | d S d S )Nr   )r   z8Collection must be of type pymilvus.Collection or String)messageconstruct_onlyF)r   r   
isinstance_collectionstrr   _name_descriptiongethas_partitionr   _get_connectioncreate_partition)selfr   r   r   kwargsr   msgconns           `/lsinfo/ai/hellotax_ai/base_platform/venv/lib/python3.11/site-packages/pymilvus/orm/partition.py__init__zPartition.__init__   s    	+*****j*-- 	/)D
C(( 	/)z*55DLC!#....
'::&.. 	F-t-diBB6BB 	N''))D!D!$"2"7MMfMMMMM	N 	N    c                 Z    t          j        | j        | j        j        | j        d          S )N)r   collection_namer   )ujsondumpsr   r   r   r#   s    r'   __repr__zPartition.__repr__9   s4    {	#'#3#8#/ 
 
 	
r)   c                 4    | j                                         S N)r   r!   r.   s    r'   r!   zPartition._get_connectionB   s    //111r)   c                     | j         S )a  str: discription of the partition.

        Examples:
            >>> from pymilvus import connections, Collection, Partition
            >>> connections.connect()
            >>> collection = Collection("test_partition_description")
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> partition.description
            'comedy films'
        )r   r.   s    r'   r   zPartition.descriptionE   s       r)   c                     | j         S )ac  str: name of the partition

        Examples:
            >>> from pymilvus import connections, Collection, Partition
            >>> connections.connect()
            >>> collection = Collection("test_partition_name")
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> partition.name
            'comedy'
        )r   r.   s    r'   r   zPartition.nameS   s     zr)   c                     | j         dk    S )aq  bool: whether the partition is empty

        Examples:
            >>> from pymilvus import connections, Collection, Partition
            >>> connections.connect()
            >>> collection = Collection("test_partition_is_empty")
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> partition.is_empty
            True
        r   )num_entitiesr.   s    r'   is_emptyzPartition.is_emptya   s      A%%r)   c                     |                                  }|                    | j        j        | j                  }d |D             }t	          |d                   |d<   |d         S )an  int: number of entities in the partition

        Examples:
            >>> from pymilvus import connections
            >>> connections.connect()
            >>> from pymilvus import Collection, Partition, FieldSchema, CollectionSchema, DataType
            >>> schema = CollectionSchema([
            ...     FieldSchema("film_id", DataType.INT64, is_primary=True),
            ...     FieldSchema("films", dtype=DataType.FLOAT_VECTOR, dim=2)
            ... ])
            >>> collection = Collection("test_partition_num_entities", schema)
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> data = [
            ...     [i for i in range(10)],
            ...     [[float(i) for i in range(2)] for _ in range(10)],
            ... ]
            >>> partition.insert(data)
            >>> partition.num_entities
            10
        )r+   partition_namec                 (    i | ]}|j         |j        S  )keyvalue).0stats     r'   
<dictcomp>z*Partition.num_entities.<locals>.<dictcomp>   s    9994$(DJ999r)   	row_count)r!   get_partition_statsr   r   int)r#   r&   statsresults       r'   r5   zPartition.num_entitieso   ss    , ##%%(( ,1$) ) 
 
 :95999!&"566{k""r)   Ntimeoutc                 d    |                                  } |j        | j        j        gfd|i| dS )a  Seal all segment in the collection of this partition.
            Inserts after flushing will be written into new segments.
            Only sealed segments can be indexed.

        Args:
            timeout (float, optional): an optional duration of time in seconds to allow
                for the RPCs.  If timeout is not set, the client keeps waiting until the server
                responds or an error occurs.
        rE   N)r!   flushr   r   r#   rE   r$   r&   s       r'   rG   zPartition.flush   sC     ##%%
D$)*FFGFvFFFFFr)   c                 j    |                                  } |j        | j        j        | j        fd|i|S )a  Drop the partition, the same as Collection.drop_partition

        Args:
            timeout (``float``, optional): an optional duration of time in seconds to allow
                for the RPCs. If timeout is not set, the client keeps waiting until the server
                responds or an error occurs.

        Raises:
            MilvusException: If anything goes wrong.

        Examples:
            >>> from pymilvus import connections, Collection, Partition
            >>> connections.connect()
            >>> collection = Collection("test_partition_drop")
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> partition.drop()
        rE   )r!   drop_partitionr   r   rH   s       r'   dropzPartition.drop   s@    $ ##%%"t"4#3#8$)__W_X^___r)   r   replica_numberc                 n    |                                  } |j        d| j        j        | j        g||d|S )a  Load the partition data into memory.

        Args:
            replica_number (``int``, optional): The replica number to load, defaults to 1.
            timeout (``float``, optional): an optional duration of time in seconds to allow
                for the RPCs. If timeout is not set, the client keeps waiting until the
                server responds or an error occurs.

        Raises:
            MilvusException: If anything goes wrong

        Examples:
            >>> from pymilvus import connections
            >>> connections.connect()
            >>> from pymilvus import Collection, Partition, FieldSchema, CollectionSchema, DataType
            >>> schema = CollectionSchema([
            ...     FieldSchema("film_id", DataType.INT64, is_primary=True),
            ...     FieldSchema("films", dtype=DataType.FLOAT_VECTOR, dim=2)
            ... ])
            >>> collection = Collection("test_partition_load", schema)
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> partition.load()
        )r+   partition_namesrL   rE   r:   )r!   load_partitionsr   r   )r#   rL   rE   r$   r&   s        r'   loadzPartition.load   sV    0 ##%%#t# 
 ,1!YK)	
 

 
 
 	
r)   c                 l    |                                  } |j        d| j        j        | j        g|d|S )a  Release the partition data from memory.

        Args:
            timeout (``float``, optional): an optional duration of time in seconds to allow
                for the RPCs. If timeout is not set, the client keeps waiting until the
                server responds or an error occurs.

        Raises:
            MilvusException: If anything goes wrong

        Examples:
            >>> from pymilvus import connections
            >>> connections.connect()
            >>> from pymilvus import Collection, Partition, FieldSchema, CollectionSchema, DataType
            >>> schema = CollectionSchema([
            ...     FieldSchema("film_id", DataType.INT64, is_primary=True),
            ...     FieldSchema("films", dtype=DataType.FLOAT_VECTOR, dim=2)
            ... ])
            >>> collection = Collection("test_partition_release", schema)
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> partition.load()
            >>> partition.release()
        )r+   rN   rE   r:   )r!   release_partitionsr   r   rH   s       r'   releasezPartition.release   sS    0 ##%%&t& 
 ,1!YK
 
 	
 
 	
r)   datac                 8     | j         j        || j        fd|i|S )a  Insert data into the partition, the same as Collection.insert(data, [partition])

        Args:
            data (``list/tuple/pandas.DataFrame/sparse types``): The specified data to insert
            partition_name (``str``): The partition name which the data will be inserted to,
                if partition name is not passed, then the data will be inserted to default partition
            timeout (``float``, optional): A duration of time in seconds to allow for the RPC
                If timeout is set to None, the client keeps waiting until the server
                responds or an error occurs.
        Returns:
            MutationResult: contains 2 properties `insert_count`, and, `primary_keys`
                `insert_count`: how may entites have been inserted into Milvus,
                `primary_keys`: list of primary keys of the inserted entities
        Raises:
            MilvusException: If anything goes wrong.

        Examples:
            >>> from pymilvus import connections
            >>> connections.connect()
            >>> from pymilvus import Collection, Partition, FieldSchema, CollectionSchema, DataType
            >>> schema = CollectionSchema([
            ...     FieldSchema("film_id", DataType.INT64, is_primary=True),
            ...     FieldSchema("films", dtype=DataType.FLOAT_VECTOR, dim=2)
            ... ])
            >>> collection = Collection("test_partition_insert", schema)
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> data = [
            ...     [i for i in range(10)],
            ...     [[float(i) for i in range(2)] for _ in range(10)],
            ... ]
            >>> res = partition.insert(data)
            >>> res.insert_count
            10
        rE   )r   insertr   r#   rT   rE   r$   s       r'   rV   zPartition.insert   s,    P 't&tTYRRR6RRRr)   exprc                 8     | j         j        || j        fd|i|S )a.  Delete entities with an expression condition.

        Args:
            expr (``str``): The specified data to insert.
            partition_names (``List[str]``): Name of partitions to delete entities.
            timeout (``float``, optional): A duration of time in seconds to allow for the RPC.
                If timeout is set to None, the client keeps waiting until the server responds
                or an error occurs.

        Returns:
            MutationResult: contains `delete_count` properties represents
            how many entities might be deleted.

        Raises:
            MilvusException: If anything goes wrong.

        Examples:
            >>> from pymilvus import Collection, Partition, FieldSchema, CollectionSchema, DataType
            >>> schema = CollectionSchema([
            ...     FieldSchema("film_id", DataType.INT64, is_primary=True),
            ...     FieldSchema("films", DataType.FLOAT_VECTOR, dim=2)
            ... ])
            >>> test_collection = Collection("test_partition_delete", schema)
            >>> test_partition = Partition(test_collection, "comedy films")
            >>> data = [
            ...     [i for i in range(10)],
            ...     [[float(i) for i in range(2)] for _ in range(10)],
            ... ]
            >>> test_partition.insert(data)
            (insert count: 10, delete count: 0, upsert count: 0, timestamp: 431044482906718212)
            >>> test_partition.delete("film_id in [0, 1]")
            (insert count: 0, delete count: 2, upsert count: 0, timestamp: 431044582560759811)
        rE   )r   deleter   )r#   rX   rE   r$   s       r'   rZ   zPartition.delete  s,    D 't&tTYRRR6RRRr)   c                 8     | j         j        || j        fd|i|S )aa  Upsert data into the collection.

        Args:
            data (``list/tuple/pandas.DataFrame/sparse types``): The specified data to upsert
            partition_name (``str``): The partition name which the data will be upserted at,
                if partition name is not passed, then the data will be upserted in default partition
            timeout (``float``, optional): A duration of time in seconds to allow for the RPC.
                If timeout is set to None, the client keeps waiting until the server responds
                or an error occurs.
        Returns:
            MutationResult: contains 2 properties `upsert_count`, and, `primary_keys`
                `upsert_count`: how may entites have been upserted at Milvus,
                `primary_keys`: list of primary keys of the upserted entities
        Raises:
            MilvusException: If anything goes wrong.

        Examples:
            >>> from pymilvus import Collection, Partition, FieldSchema, CollectionSchema, DataType
            >>> schema = CollectionSchema([
            ...     FieldSchema("film_id", DataType.INT64, is_primary=True),
            ...     FieldSchema("films", dtype=DataType.FLOAT_VECTOR, dim=2)
            ... ])
            >>> collection = Collection("test_partition_upsert", schema)
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> data = [
            ...     [i for i in range(10)],
            ...     [[float(i) for i in range(2)] for _ in range(10)],
            ... ]
            >>> res = partition.upsert(data)
            >>> res.upsert_count
            10
        rE   )r   upsertr   rW   s       r'   r\   zPartition.upsert>  s,    L 't&tTYRRR6RRRr)   
anns_fieldparamlimitoutput_fieldsround_decimalc	                 F     | j         j        d|||||| j        g|||d	|	S )a  Conducts a vector similarity search with an optional boolean expression as filter.

        Args:
            data (``List[List[float]]`` or sparse types): The vectors of search data.
                the length of data is number of query (nq),
                and the dim of every vector in data must be equal to the vector field of collection.
            anns_field (``str``): The name of the vector field used to search of collection.
            param (``dict[str, Any]``):

                The parameters of search. The followings are valid keys of param.

                * *nprobe*, *ef*, *search_k*, etc
                    Corresponding search params for a certain index.

                * *metric_type* (``str``)
                    similar metricy types, the value must be of type str.

                * *offset* (``int``, optional)
                    offset for pagination.

                * *limit* (``int``, optional)
                    limit for the search results and pagination.

                example for param::

                    {
                        "nprobe": 128,
                        "metric_type": "L2",
                        "offset": 10,
                        "limit": 10,
                    }

            limit (``int``): The max number of returned record, also known as `topk`.
            expr (``str``): The boolean expression used to filter attribute. Default to None.

                example for expr::

                    "id_field >= 0", "id_field in [1, 2, 3, 4]"

            output_fields (``List[str]``, optional):
                The name of fields to return in the search result.  Can only get scalar fields.
            round_decimal (``int``, optional): The specified number of decimal places of
                returned distance......... Defaults to -1 means no round to returned distance.
            **kwargs (``dict``): Optional search params

                *  *_async* (``bool``, optional)
                    Indicate if invoke asynchronously.
                    Returns a SearchFuture if True, else returns results from server directly.

                * *_callback* (``function``, optional)
                    The callback function which is invoked after server response successfully.
                    It functions only if _async is set to True.

                * *consistency_level* (``str/int``, optional)
                    Which consistency level to use when searching in the collection.

                    Options of consistency level: Strong, Bounded, Eventually, Session, Customized.

                    Note: this parameter overwrites the same one specified when creating collection,
                    if no consistency level was specified, search will use the
                    consistency level when you create the collection.

                * *guarantee_timestamp* (``int``, optional)
                    Instructs Milvus to see all operations performed before this timestamp.
                    By default Milvus will search all operations performed to date.

                    Note: only valid in Customized consistency level.

                * *graceful_time* (``int``, optional)
                    Search will use the (current_timestamp - the graceful_time) as the
                    `guarantee_timestamp`. By default with 5s.

                    Note: only valid in Bounded consistency level

        Returns:
            SearchResult:
                Returns ``SearchResult`` if `_async` is False , otherwise ``SearchFuture``

        .. _Metric type documentations:
            https://milvus.io/docs/v2.2.x/metric.md
        .. _Index documentations:
            https://milvus.io/docs/v2.2.x/index.md
        .. _How guarantee ts works:
            https://github.com/milvus-io/milvus/blob/master/docs/developer_guides/how-guarantee-ts-works.md

        Raises:
            MilvusException: If anything goes wrong

        Examples:
            >>> from pymilvus import Collection, FieldSchema, CollectionSchema, DataType
            >>> import random
            >>> schema = CollectionSchema([
            ...     FieldSchema("film_id", DataType.INT64, is_primary=True),
            ...     FieldSchema("films", dtype=DataType.FLOAT_VECTOR, dim=2)
            ... ])
            >>> collection = Collection("test_collection_search", schema)
            >>> collection.create_index(
            ...     "films",
            ...     {"index_type": "FLAT", "metric_type": "L2", "params": {}})
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> # insert
            >>> data = [
            ...     [i for i in range(10)],
            ...     [[random.random() for _ in range(2)] for _ in range(10)],
            ... ]
            >>> partition.insert(data)
            >>> partition.load()
            >>> # search
            >>> search_param = {
            ...     "data": [[1.0, 1.0]],
            ...     "anns_field": "films",
            ...     "param": {"metric_type": "L2"},
            ...     "limit": 2,
            ...     "expr": "film_id > 0",
            ... }
            >>> res = partition.search(**search_param)
            >>> assert len(res) == 1
            >>> hits = res[0]
            >>> assert len(hits) == 2
            >>> print(f"- Total hits: {len(hits)}, hits ids: {hits.ids} ")
            - Total hits: 2, hits ids: [8, 5]
            >>> print(f"- Top1 hit id: {hits[0].id}, score: {hits[0].score} ")
            - Top1 hit id: 8, score: 0.10143111646175385
        )	rT   r^   r_   r`   rX   rN   ra   rb   rE   r:   )r   searchr   )
r#   rT   r^   r_   r`   rX   ra   rE   rb   r$   s
             r'   rd   zPartition.searchf  sR    R 't& 
!!YK''
 
 
 
 	
r)   reqsrerankc                 B     | j         j        d|||| j        g|||d|S )a~  Conducts multi vector similarity search with a rerank for rearrangement.

        Args:
            reqs (``List[AnnSearchRequest]``): The vector search requests.
            rerank (``BaseRanker``): The reranker for rearrange nummer of limit results.
            limit (``int``): The max number of returned record, also known as `topk`.

            output_fields (``List[str]``, optional):
                The name of fields to return in the search result.  Can only get scalar fields.
            round_decimal (``int``, optional):
                The specified number of decimal places of returned distance.
                Defaults to -1 means no round to returned distance.
            timeout (``float``, optional): A duration of time in seconds to allow for the RPC.
                If timeout is set to None, the client keeps waiting until the server
                responds or an error occurs.
            **kwargs (``dict``): Optional search params

                *  *_async* (``bool``, optional)
                    Indicate if invoke asynchronously.
                    Returns a SearchFuture if True, else returns results from server directly.

                * *_callback* (``function``, optional)
                    The callback function which is invoked after server response successfully.
                    It functions only if _async is set to True.

                * *offset* (``int``, optinal)
                    offset for pagination.

                * *consistency_level* (``str/int``, optional)
                    Which consistency level to use when searching in the collection.

                    Options of consistency level: Strong, Bounded, Eventually, Session, Customized.

                    Note: this parameter overwrites the same one specified when creating collection,
                    if no consistency level was specified, search will use the
                    consistency level when you create the collection.

                * *guarantee_timestamp* (``int``, optional)
                    Instructs Milvus to see all operations performed before this timestamp.
                    By default Milvus will search all operations performed to date.

                    Note: only valid in Customized consistency level.

                * *graceful_time* (``int``, optional)
                    Search will use the (current_timestamp - the graceful_time) as the
                    `guarantee_timestamp`. By default with 5s.

                    Note: only valid in Bounded consistency level

        Returns:
            SearchResult:
                Returns ``SearchResult`` if `_async` is False , otherwise ``SearchFuture``

        .. _Metric type documentations:
            https://milvus.io/docs/v2.2.x/metric.md
        .. _Index documentations:
            https://milvus.io/docs/v2.2.x/index.md
        .. _How guarantee ts works:
            https://github.com/milvus-io/milvus/blob/master/docs/developer_guides/how-guarantee-ts-works.md

        Raises:
            MilvusException: If anything goes wrong

        Examples:
            >>> from pymilvus import (Collection, FieldSchema, CollectionSchema, DataType
            >>>     AnnSearchRequest, RRFRanker, WeightedRanker)
            >>> import random
            >>> schema = CollectionSchema([
            ...     FieldSchema("film_id", DataType.INT64, is_primary=True),
            ...     FieldSchema("films", dtype=DataType.FLOAT_VECTOR, dim=2),
            ...     FieldSchema("poster", dtype=DataType.FLOAT_VECTOR, dim=2),
            ... ])
            >>> collection = Collection("test_collection_search", schema)
            >>> collection.create_index(
            ...     "films",
            ...     {"index_type": "FLAT", "metric_type": "L2", "params": {}})
            >>> collection.create_index(
            ...     "poster",
            ...     {"index_type": "FLAT", "metric_type": "L2", "params": {}})
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> # insert
            >>> data = [
            ...     [i for i in range(10)],
            ...     [[random.random() for _ in range(2)] for _ in range(10)],
            ...     [[random.random() for _ in range(2)] for _ in range(10)],
            ... ]
            >>> partition.insert(data)
            >>> partition.load()
            >>> # search
            >>> search_param1 = {
            ...     "data": [[1.0, 1.0]],
            ...     "anns_field": "films",
            ...     "param": {"metric_type": "L2"},
            ...     "limit": 2,
            ...     "expr": "film_id > 0",
            ... }
            >>> req1 = AnnSearchRequest(**search_param1)
            >>> search_param2 = {
            ...     "data": [[2.0, 2.0]],
            ...     "anns_field": "poster",
            ...     "param": {"metric_type": "L2", "offset": 1},
            ...     "limit": 2,
            ...     "expr": "film_id > 0",
            ... }
            >>> req2 = AnnSearchRequest(**search_param2)
            >>> res = partition.hybrid_search([req1, req2], WeightedRanker(0.9, 0.1), 2)
            >>> assert len(res) == 1
            >>> hits = res[0]
            >>> assert len(hits) == 2
            >>> print(f"- Total hits: {len(hits)}, hits ids: {hits.ids} ")
            - Total hits: 2, hits ids: [8, 5]
            >>> print(f"- Top1 hit id: {hits[0].id}, score: {hits[0].score} ")
            - Top1 hit id: 8, score: 0.10143111646175385
        )re   rf   r`   rN   ra   rb   rE   r:   )r   hybrid_searchr   )r#   re   rf   r`   ra   rE   rb   r$   s           r'   rh   zPartition.hybrid_search  sL    z .t- 	
!YK''	
 	
 	
 	
 		
r)   c                 <     | j         j        d||| j        g|d|S )a  Query with expressions

        Args:
            expr (``str``): The query expression.
            output_fields(``List[str]``): A list of field names to return. Defaults to None.
            timeout (``float``, optional): A duration of time in seconds to allow for the RPC.
                If timeout is set to None, the client keeps waiting until the server responds
                or an error occurs.
            **kwargs (``dict``, optional):

                * *consistency_level* (``str/int``, optional)
                    Which consistency level to use when searching in the collection.

                    Options of consistency level: Strong, Bounded, Eventually, Session, Customized.

                    Note: this parameter overwrites the same one specified when creating collection,
                    if no consistency level was specified, search will use the
                    consistency level when you create the collection.

                * *guarantee_timestamp* (``int``, optional)
                    Instructs Milvus to see all operations performed before this timestamp.
                    By default Milvus will search all operations performed to date.

                    Note: only valid in Customized consistency level.

                * *graceful_time* (``int``, optional)
                    Search will use the (current_timestamp - the graceful_time) as the
                    `guarantee_timestamp`. By default with 5s.

                    Note: only valid in Bounded consistency level

                * *offset* (``int``)
                    Combined with limit to enable pagination

                * *limit* (``int``)
                    Combined with limit to enable pagination

        Returns:
            List, contains all results

        Raises:
            MilvusException: If anything goes wrong

        Examples:
            >>> from pymilvus import Collection, FieldSchema, CollectionSchema, DataType
            >>> import random
            >>> schema = CollectionSchema([
            ...     FieldSchema("film_id", DataType.INT64, is_primary=True),
            ...     FieldSchema("film_date", DataType.INT64),
            ...     FieldSchema("films", dtype=DataType.FLOAT_VECTOR, dim=2)
            ... ])
            >>> collection = Collection("test_collection_query", schema)
            >>> collection.create_index(
            ...     "films",
            ...     {"index_type": "FLAT", "metric_type": "L2", "params": {}})
            >>> partition = Partition(collection, "comedy", "comedy films")
            >>> # insert
            >>> data = [
            ...     [i for i in range(10)],
            ...     [i + 2000 for i in range(10)],
            ...     [[random.random() for _ in range(2)] for _ in range(10)],
            ... ]
            >>> partition.insert(data)
            >>> partition.load()
            >>> # query
            >>> expr = "film_id in [ 0, 1 ]"
            >>> res = partition.query(expr, output_fields=["film_date"])
            >>> assert len(res) == 2
            >>> print(f"- Query results: {res}")
            - Query results: [{'film_id': 0, 'film_date': 2000}, {'film_id': 1, 'film_date': 2001}]
        )rX   ra   rN   rE   r:   )r   queryr   )r#   rX   ra   rE   r$   s        r'   rj   zPartition.query  sC    ^ &t% 
'!YK	
 

 
 
 	
r)   c                 *     | j         j        dd|i|S )aJ  Get the current loaded replica information

        Args:
            timeout (``float``, optional): An optional duration of time in seconds to allow for
            the RPC. When timeout is set to None, client waits until server response or error occur.
        Returns:
            Replica: All the replica information.
        rE   r:   )r   get_replicas)r#   rE   r$   s      r'   rl   zPartition.get_replicas  s%     -t,GGWGGGGr)   )r   r1   )r   N)NNNr]   )NNr]   )NN)(__name__
__module____qualname__r   r   r   r   r(   r/   r!   propertyr   r   boolr6   rB   r5   r   floatrG   rK   rP   rS   r   pd	DataFramer   SparseMatrixInputTyper   rV   rZ   r\   r   r
   rd   r	   rh   rj   r   rl   r:   r)   r'   r   r      sb       
 	N N*c/*N N 	N 
N N N N6
# 
 
 
 
2 2 2 !S ! ! ! X! c    X &$ & & & X& #c # # # X#:G GXe_ G G G G` `HUO ` ` ` `*
 
3 
Xe_ 
 
 
 
B
 
x 
 
 
 
F $((S (SD",(CCD(S %(S
 
(S (S (S (ST"S "S3 "S% "S "S "S "SN $(&S &SD",(CCD&S %&S
 
&S &S &S &S\ #-1#'T
 T
D%556T
 T
 	T

 T
 smT
  S	*T
 %T
 T
 
T
 T
 T
 T
v .2#'F
 F
F
 F
 	F

  S	*F
 %F
 F
 F
 F
 F
V .2#'	U
 U
U
  S	*U
 %	U
 U
 U
 U
n	H 	HHUO 	H 	H 	H 	H 	H 	H 	Hr)   )typingr   r   r   r   r   pandasrs   r,   pymilvus.clientr   pymilvus.client.abstractr	   r
   pymilvus.client.typesr   pymilvus.exceptionsr   mutationr   r   r   r:   r)   r'   <module>r}      s
   8 7 7 7 7 7 7 7 7 7 7 7 7 7      ! ! ! ! ! ! = = = = = = = = ) ) ) ) ) ) / / / / / / $ $ $ $ $ $W\""
GK  	GH GH GH GH GH GH GH GH GH GHr)   