class_docstr: Hook for Google Cloud Dataproc Metastore APIs.
class_docstr_tok: ["Hook","for","Google","Cloud","Dataproc","Metastore","APIs","."]
docstr: Lists Hive partitions.
  
  :param project_id: Optional. The ID of a dbt Cloud project.
  :param service_id: Required. Dataproc Metastore service id.
  :param region: Required. The ID of the Google Cloud region that the service belongs to.
  :param table: Required. Name of the partitioned table
  :param partition_names: Optional. List of table partitions to wait for.
      A name of a partition should look like "ds=1", or "a=1/b=2" in case of multiple partitions.
      Note that you cannot use logical or comparison operators as in HivePartitionSensor.
      If not specified then the sensor will wait for at least one partition regardless its name.
docstr_tok: ["Lists","Hive","partitions",".",":","param","project_id",":","Optional",".","The","ID","of","a","dbt","Cloud","project",".",":","param","service_id",":","Required",".","Dataproc","Metastore","service","id",".",":","param","region",":","Required",".","The","ID","of","the","Google","Cloud","region","that","the","service","belongs","to",".",":","param","table",":","Required",".","Name","of","the","partitioned","table",":","param","partition_names",":","Optional",".","List","of","table","partitions","to","wait","for",".","A","name","of","a","partition","should","look","like","``","ds=1","''",",","or","``","a=1\/b=2","''","in","case","of","multiple","partitions",".","Note","that","you","can","not","use","logical","or","comparison","operators","as","in","HivePartitionSensor",".","If","not","specified","then","the","sensor","will","wait","for","at","least","one","partition","regardless","its","name","."]
code: def list_hive_partitions(
      self,
      project_id: str,
      service_id: str,
      region: str,
      table: str,
      partition_names: list[str] | None = None,
  ) -> Operation:
      """
      Lists Hive partitions.
  
      :param project_id: Optional. The ID of a dbt Cloud project.
      :param service_id: Required. Dataproc Metastore service id.
      :param region: Required. The ID of the Google Cloud region that the service belongs to.
      :param table: Required. Name of the partitioned table
      :param partition_names: Optional. List of table partitions to wait for.
          A name of a partition should look like "ds=1", or "a=1/b=2" in case of multiple partitions.
          Note that you cannot use logical or comparison operators as in HivePartitionSensor.
          If not specified then the sensor will wait for at least one partition regardless its name.
      """
      # Remove duplicates from the `partition_names` and preserve elements order
      # because dictionaries are ordered since Python 3.7+
      _partitions = (
          list(dict.fromkeys(partition_names))
          if partition_names
          else []
      )
  
      query = f"""
                  SELECT *
                  FROM PARTITIONS
                  INNER JOIN TBLS
                  ON PARTITIONS.TBL_ID = TBLS.TBL_ID
                  WHERE
                      TBLS.TBL_NAME = '{table}'"""
      if _partitions:
          query += f"""
                      AND PARTITIONS.PART_NAME IN ({', '.join(f"'{p}'" for p in _partitions)})"""
      query += ";"
  
      client = self.get_dataproc_metastore_client_v1beta()
      result = client.query_metadata(
          request={
              "service": f"projects/{project_id}/locations/{region}/services/{service_id}",
              "query": query,
          }
      )
      return result
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Any, Sequence
  from google.api_core.client_options import ClientOptions
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
  from google.cloud.metastore_v1 import DataprocMetastoreClient
  from airflow.exceptions import AirflowException
  from airflow.providers.google.common.consts import CLIENT_INFO
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
label_desc: Use image node_id 16 for calling the DataprocMetastoreHook obj's underlying member method code with example usage: obj.list_hive_partitions(project_id, service_id, region, table, partition_names) and returns: result