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: Insert data into the Milvus collection.
docstr_tok: ["Insert","data","into","the","Milvus","collection","."]
code: def insert(
      self,
      table_name: str,
      data: pd.DataFrame,
      columns: List[str] = None,
  ) -> HandlerResponse:
      """Insert data into the Milvus collection."""
      collection = None
      try:
          collection = Collection(table_name)
      except Exception as e:
          return Response(
              resp_type=RESPONSE_TYPE.ERROR,
              error_message=f"Unable to fetch collection `{table_name}`: {e}",
          )
      try:
          data = data[columns]
          if TableField.METADATA.value in data.columns:
              rows = data[TableField.METADATA.value].to_list()
              data = pd.concat(
                  [data, pd.DataFrame.from_records(rows)], axis=1
              )
              data.drop(TableField.METADATA.value, axis=1, inplace=True)
          collection.insert(data.to_dict(orient="records"))
          collection.flush()
      except Exception as e:
          return Response(
              resp_type=RESPONSE_TYPE.ERROR,
              error_message=f"Unable to insert data into collection `{table_name}`: {e}",
          )
      return Response(resp_type=RESPONSE_TYPE.OK)
  
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 12 for calling the MilvusHandler obj's underlying member method code with example usage: obj.insert(table_name, data, columns) and returns: Response, Response, Response