'Checks whether a partition with a given name exists
:param schema: Name of hive schema (database) @table belongs to
:type schema: string
:param table: Name of hive table @partition belongs to
:type schema: string
:partition: Name of the partitions to check for (eg `a=b/c=d`)
:type schema: string
:rtype: boolean
>>> hh = HiveMetastoreHook()
>>> t = \'static_babynames_partitioned\'
>>> hh.check_for_named_partition(\'airflow\', t, "ds=2015-01-01")
True
>>> hh.check_for_named_partition(\'airflow\', t, "ds=xxx")
False'

def check_for_named_partition(self, schema, table, partition_name):

    self.metastore._oprot.trans.open()
    try:
        self.metastore.get_partition_by_name(schema, table, partition_name)
        return True
    except hive_metastore.ttypes.NoSuchObjectException:
        return False
    finally:
        self.metastore._oprot.trans.close()
