class_docstr: Base class for handlers associated to vector databases.
class_docstr_tok: ["Base","class","for","handlers","associated","to","vector","databases","."]
docstr: Dispatch insert query to the appropriate method.
docstr_tok: ["Dispatch","insert","query","to","the","appropriate","method","."]
code: def _dispatch_insert(self, query: Insert):
      """
      Dispatch insert query to the appropriate method.
      """
      # parse key arguments
      table_name = query.table.parts[-1]
      columns = [column.name for column in query.columns]
  
      if not self._is_columns_allowed(columns):
          raise Exception(
              f"Columns {columns} not allowed."
              f"Allowed columns are {[col['name'] for col in self.SCHEMA]}"
          )
  
      # get content column if it is present
      if TableField.CONTENT.value in columns:
          content_col_index = columns.index("content")
          content = [
              self._value_or_self(row[content_col_index])
              for row in query.values
          ]
      else:
          content = None
  
      # get id column if it is present
      ids = None
      if TableField.ID.value in columns:
          id_col_index = columns.index("id")
          ids = [
              self._value_or_self(row[id_col_index])
              for row in query.values
          ]
      elif TableField.CONTENT.value is None:
          raise Exception("Content or id is required!")
  
      # get embeddings column if it is present
      if TableField.EMBEDDINGS.value in columns:
          embeddings_col_index = columns.index("embeddings")
          embeddings = [
              ast.literal_eval(
                  self._value_or_self(row[embeddings_col_index])
              )
              for row in query.values
          ]
      else:
          raise Exception("Embeddings column is required!")
  
      if TableField.METADATA.value in columns:
          metadata_col_index = columns.index("metadata")
          metadata = [
              ast.literal_eval(
                  self._value_or_self(row[metadata_col_index])
              )
              for row in query.values
          ]
      else:
          metadata = None
  
      # create dataframe
      data = {
          TableField.CONTENT.value: content,
          TableField.EMBEDDINGS.value: embeddings,
          TableField.METADATA.value: metadata,
      }
      if ids is not None:
          data[TableField.ID.value] = ids
  
      return self.do_upsert(table_name, pd.DataFrame(data))
  
imports: import ast
  import hashlib
  from enum import Enum
  from typing import Any, List, Optional
  import pandas
  from mindsdb_sql.parser.ast import BinaryOperation, Constant, CreateTable, Delete, DropTables, Insert, Select, Star, Tuple, Update
  from mindsdb_sql.parser.ast.base import ASTNode
  from mindsdb.integrations.libs.response import RESPONSE_TYPE, HandlerResponse
  from mindsdb.utilities import log
  from mindsdb.integrations.utilities.sql_utils import conditions_to_filter
  from ..utilities.sql_utils import query_traversal
  from .base import BaseHandler
label_desc: Use image node_id 10 for calling the VectorStoreHandler obj's underlying member method code with example usage: obj._dispatch_insert(query) and returns: self