def get_relation_count_query(self, query, parent):
        """
        Add the constraints for a relationship count query.

        :type query: Builder
        :type parent: Builder

        :rtype: Builder
        """
        query.select(QueryExpression("COUNT(*)"))

        key = self.wrap(self.get_qualified_parent_key_name())

        return query.where(self.get_has_compare_key(), "=", QueryExpression(key))
Add the constraints for a relationship count query.

        :type query: Builder
        :type parent: Builder

        :rtype: Builder