class CreateDomain(_CreateDropBase):
    """Represent a CREATE DOMAIN statement."""
__visit_name__ = 'create_domain'

def __init__(self, element, bind=None, **kw):
    super(CreateDomain, self).__init__(element, bind=bind, **kw)


class DropDomain(_CreateDropBase):
    """Represent a DROP BASE statement."""
__visit_name__ = 'drop_domain'

def __init__(self, element, bind=None, **kw):
    super(DropDomain, self).__init__(element, bind=bind, **kw)

@compiles(CreateDomain, 'postgresql')
def visit_create_domain(element, compiler, **kw):
    text = '\nCREATE DOMAIN %s AS %s' % (compiler.prepare.format_column(
        element.name), compiler.preparer.format_column(element.type_))
default = compiler.get_column_default_string(column)
if default is not None:
    text += ' DEFAULT %s' % default
return text
How to represent a custom PostgreSQL domain in SQLAlchemy?