class_docstr: This handler handles connection and execution of the LanceDB statements.
class_docstr_tok: ["This","handler","handles","connection","and","execution","of","the","LanceDB","statements","."]
docstr: Translate a list of FilterCondition objects to string that can be used by LanceDB.
  E.g.,
  [
      FilterCondition(
          column="content",
          op=FilterOperator.NOT_EQUAL,
          value="a",
      ),
      FilterCondition(
          column="id",
          op=FilterOperator.EQUAL,
          value="6",
      )
  ]
  -->
      "content != 'a' and id = '6'"
docstr_tok: ["Translate","a","list","of","FilterCondition","objects","to","string","that","can","be","used","by","LanceDB",".","E.g.",",","[","FilterCondition","(","column=","''","content","''",",","op=FilterOperator.NOT_EQUAL",",","value=","''","a","''",",",")",",","FilterCondition","(","column=","''","id","''",",","op=FilterOperator.EQUAL",",","value=","''","6","''",",",")","]","--",">","``","content","!","=","'","a","'","and","id","=","'","6","'","''"]
code: def _translate_condition(
      self, conditions: List[FilterCondition]
  ) -> Optional[dict]:
      """
      Translate a list of FilterCondition objects to string that can be used by LanceDB.
      E.g.,
      [
          FilterCondition(
              column="content",
              op=FilterOperator.NOT_EQUAL,
              value="a",
          ),
          FilterCondition(
              column="id",
              op=FilterOperator.EQUAL,
              value="6",
          )
      ]
      -->
          "content != 'a' and id = '6'"
      """
      # we ignore all non-metadata conditions
      if not conditions:
          return
      filtered_conditions = [
          condition
          for condition in conditions
          if condition.column.startswith(TableField.ID.value)
          or condition.column.startswith(TableField.CONTENT.value)
      ]
  
      if len(filtered_conditions) == 0:
          return None
  
      # generate the LanceDB filter string
      lancedb_conditions = []
      for condition in filtered_conditions:
          if isinstance(condition.value, str):
              condition.value = f"'{condition.value}'"
          condition_key = condition.column.split(".")[-1]
          lancedb_conditions.append(
              " ".join(
                  [
                      condition_key,
                      self._get_lancedb_operator(condition.op),
                      str(condition.value),
                  ]
              )
          )
      # Combine all conditions into a single string and return
      return (
          " and ".join(lancedb_conditions)
          if lancedb_conditions
          else None
      )
  
imports: from collections import OrderedDict
  from typing import List, Optional
  import lancedb
  import pandas
  import pyarrow
  from lance.vector import vec_to_table
  import duckdb
  import json
  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 8 for calling the LanceDBHandler obj's underlying member method code with example usage: obj._translate_condition(conditions) and returns: unknown, None