class_docstr: This handler handles connection and execution of the Milvus statements.
class_docstr_tok: ["This","handler","handles","connection","and","execution","of","the","Milvus","statements","."]
docstr: Translate a list of FilterCondition objects a string that can be used by Milvus.
  E.g.,
  [
      FilterCondition(
          column="metadata.price",
          op=FilterOperator.LESS_THAN,
          value=1000,
      ),
      FilterCondition(
          column="metadata.price",
          op=FilterOperator.GREATER_THAN,
          value=300,
      )
  ]
  Is converted to: "(price < 1000) and (price > 300)"
  If exclude_id is set to true then id column is ignored
docstr_tok: ["Translate","a","list","of","FilterCondition","objects","a","string","that","can","be","used","by","Milvus",".","E.g.",",","[","FilterCondition","(","column=","''","metadata.price","''",",","op=FilterOperator.LESS_THAN",",","value=1000",",",")",",","FilterCondition","(","column=","''","metadata.price","''",",","op=FilterOperator.GREATER_THAN",",","value=300",",",")","]","Is","converted","to",":","``","(","price","<","1000",")","and","(","price",">","300",")","''","If","exclude_id","is","set","to","true","then","id","column","is","ignored"]
code: def _translate_conditions(
      self,
      conditions: Optional[List[FilterCondition]],
      exclude_id: bool = True,
  ) -> Optional[str]:
      """
      Translate a list of FilterCondition objects a string that can be used by Milvus.
      E.g.,
      [
          FilterCondition(
              column="metadata.price",
              op=FilterOperator.LESS_THAN,
              value=1000,
          ),
          FilterCondition(
              column="metadata.price",
              op=FilterOperator.GREATER_THAN,
              value=300,
          )
      ]
      Is converted to: "(price < 1000) and (price > 300)"
      If exclude_id is set to true then id column is ignored
      """
      if not conditions:
          return
      # Ignore all non-metadata conditions
      filtered_conditions = [
          condition
          for condition in conditions
          if condition.column.startswith(TableField.METADATA.value)
          or condition.column.startswith(TableField.ID.value)
      ]
      if len(filtered_conditions) == 0:
          return None
      # Translate each metadata condition into a dict
      milvus_conditions = []
      for condition in filtered_conditions:
          if isinstance(condition.value, str):
              condition.value = f"'{condition.value}'"
          milvus_conditions.append(
              f"({condition.column.split('.')[-1]} {self._get_milvus_operator(condition.op)} {condition.value})"
          )
      # Combine all metadata conditions into a single string and return
      return (
          " and ".join(milvus_conditions) if milvus_conditions else None
      )
  
imports: from collections import OrderedDict
  from typing import List, Optional
  import pandas
  from pymilvus import Collection, CollectionSchema, DataType, FieldSchema, connections, utility
  from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE
  from mindsdb.integrations.libs.response import RESPONSE_TYPE
  from mindsdb.integrations.libs.response import HandlerResponse
  from mindsdb.integrations.libs.response import HandlerResponse
  from mindsdb.integrations.libs.response import HandlerStatusResponse
  from mindsdb.integrations.libs.vectordatabase_handler import FilterCondition, FilterOperator, TableField, VectorStoreHandler
  from mindsdb.utilities import log
label_desc: Use image node_id 9 for calling the MilvusHandler obj's underlying member method code with example usage: obj._translate_conditions(conditions, exclude_id) and returns: unknown, None