def _do_count_by_product(self, query):
    for (q, dataset_type) in self._get_product_queries(query):
        dataset_fields = dataset_type.metadata_type.dataset_fields
        query_exprs = tuple(fields.to_expressions(dataset_fields.get, **q))
        count = self._db.count_datasets(query_exprs)
        if (count > 0):
            (yield (dataset_type, count))
def _do_count_by_product(self, query):
    for (q, dataset_type) in self._get_product_queries(query):
        dataset_fields = dataset_type.metadata_type.dataset_fields
        query_exprs = tuple(fields.to_expressions(dataset_fields.get, **q))
        count = self._db.count_datasets(query_exprs)
        if (count > 0):
            (yield (dataset_type, count))