class_docstr: Youtube List Comments  by video id Table implementation
class_docstr_tok: ["Youtube","List","Comments","by","video","id","Table","implementation"]
docstr: Pulls data from the youtube  "commentThreads()" API endpoint
  Parameters
  ----------
  query : ast.Select
     Given SQL SELECT query
  Returns
  -------
  pd.DataFrame
      youtube "commentThreads()" matching the query
  Raises
  ------
  ValueError
      If the query contains an unsupported condition
docstr_tok: ["Pulls","data","from","the","youtube","``","commentThreads","(",")","''","API","endpoint","Parameters","--","--","--","--","--","query",":","ast.Select","Given","SQL","SELECT","query","Returns","--","--","--","-","pd.DataFrame","youtube","``","commentThreads","(",")","''","matching","the","query","Raises","--","--","--","ValueError","If","the","query","contains","an","unsupported","condition"]
code: def select(self, query: ast.Select) -> pd.DataFrame:
      """Pulls data from the youtube  "commentThreads()" API endpoint
      Parameters
      ----------
      query : ast.Select
         Given SQL SELECT query
      Returns
      -------
      pd.DataFrame
          youtube "commentThreads()" matching the query
      Raises
      ------
      ValueError
          If the query contains an unsupported condition
      """
      select_statement_parser = SELECTQueryParser(
          query, "comments", self.get_columns()
      )
  
      (
          selected_columns,
          where_conditions,
          order_by_conditions,
          result_limit,
      ) = select_statement_parser.parse_query()
  
      channel_id, video_id = None, None
      for a_where in where_conditions:
          if a_where[1] == "video_id":
              if a_where[0] != "=":
                  raise NotImplementedError(
                      "Only '=' operator is supported for video_id column."
                  )
              else:
                  video_id = a_where[2]
          elif a_where[1] == "channel_id":
              if a_where[0] != "=":
                  raise NotImplementedError(
                      "Only '=' operator is supported for channel_id column."
                  )
              else:
                  channel_id = a_where[2]
  
      if not video_id and not channel_id:
          raise ValueError(
              "Either video_id or channel_id has to be present in where clause."
          )
  
      comments_df = self.get_comments(
          video_id=video_id, channel_id=channel_id
      )
  
      select_statement_executor = SELECTQueryExecutor(
          comments_df,
          selected_columns,
          [
              where_condition
              for where_condition in where_conditions
              if where_condition[1] not in ["video_id", "channel_id"]
          ],
          order_by_conditions,
          result_limit if query.limit else None,
      )
  
      comments_df = select_statement_executor.execute_query()
  
      return comments_df
  
imports: from typing import List
  from mindsdb.integrations.libs.api_handler import APITable
  from mindsdb.integrations.utilities.sql_utils import extract_comparison_conditions
  from mindsdb.utilities import log
  from mindsdb_sql.parser import ast
  from mindsdb.integrations.handlers.utilities.query_utilities import SELECTQueryParser, SELECTQueryExecutor, INSERTQueryParser
  import pandas
  import re
  from youtube_transcript_api import YouTubeTranscriptApi
  from youtube_transcript_api.formatters import JSONFormatter
label_desc: Use image node_id 1 for calling the YoutubeCommentsTable obj's underlying member method code with example usage: obj.select(query) and returns: comments_df