def get_check_declaration_sql(self, definition):
        """
        Obtains DBMS specific SQL code portion needed to set a CHECK constraint
        declaration to be used in statements like CREATE TABLE.

        :param definition: The check definition
        :type definition: dict

        :return: DBMS specific SQL code portion needed to set a CHECK constraint.
        :rtype: str
        """
        constraints = []
        for field, def_ in definition.items():
            if isinstance(def_, basestring):
                constraints.append('CHECK (%s)' % def_)
            else:
                if 'min' in def_:
                    constraints.append('CHECK (%s >= %s)' % (field, def_['min']))

                if 'max' in def_:
                    constraints.append('CHECK (%s <= %s)' % (field, def_['max']))

        return ', '.join(constraints)
dataset/ETHPy150Open sdispater/orator/orator/dbal/platforms/platform.py/Platform.get_check_declaration_sql/original