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","."]
code: def select(
      self,
      table_name: str,
      columns: List[str] = None,
      conditions: List[FilterCondition] = None,
      offset: int = None,
      limit: int = None,
  ) -> HandlerResponse:
      try:
          # Load collection table
          collection = self._client.open_table(table_name)
      except Exception as e:
          return Response(
              resp_type=RESPONSE_TYPE.ERROR,
              error_message=f"Error loading collection {table_name}: {e}",
          )
      filters = self._translate_condition(conditions)
      # check if embedding vector filter is present
      vector_filter = (
          []
          if conditions is None
          else [
              condition
              for condition in conditions
              if condition.column == TableField.SEARCH_VECTOR.value
          ]
      )
  
      if len(vector_filter) > 0:
          vector_filter = vector_filter[0]
      else:
          vector_filter = None
  
      if vector_filter is not None:
          vec = (
              json.loads(vector_filter.value)
              if isinstance(vector_filter.value, str)
              else vector_filter.value
          )
          result = collection.search(vec).select(columns).to_pandas()
          result = result.rename(
              columns={"_distance": TableField.DISTANCE.value}
          )
      else:
          result = self._client.open_table(table_name).to_pandas()
  
      new_columns = (
          columns + [TableField.DISTANCE.value]
          if TableField.DISTANCE.value in result.columns
          else columns
      )
  
      col_str = ", ".join(
          [
              col
              for col in new_columns
              if col
              in (
                  TableField.ID.value,
                  TableField.CONTENT.value,
                  TableField.METADATA.value,
                  TableField.EMBEDDINGS.value,
                  TableField.DISTANCE.value,
              )
          ]
      )
  
      where_str = f"where {filters}" if filters else ""
      # implementing limit and offset. Not supported natively in lancedb
      if limit and offset:
          sql = f"""select {col_str} from result {where_str} limit {limit} offset {offset}"""
      elif limit and not offset:
          sql = f"""select {col_str} from result {where_str} limit {limit}"""
      elif offset and not limit:
          sql = f"""select {col_str} from result {where_str} offset {offset}"""
      else:
          sql = f"""select {col_str} from result {where_str}"""
  
      data_df = duckdb.query(sql).to_df()
      return Response(resp_type=RESPONSE_TYPE.TABLE, data_frame=data_df)
  
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 9 for calling the LanceDBHandler obj's underlying member method code with example usage: obj.select(table_name, columns, conditions, offset, limit) and returns: Response, Response