class_docstr: Represent the DOMAIN PostgreSQL type.
  
  A domain is essentially a data type with optional constraints
  that restrict the allowed set of values. E.g.::
  
      PositiveInt = DOMAIN(
          "pos_int", Integer, check="VALUE > 0", not_null=True
      )
  
      UsPostalCode = DOMAIN(
          "us_postal_code",
          Text,
          check="VALUE ~ '^\d{5}$' OR VALUE ~ '^\d{5}-\d{4}$'"
      )
  
  See the `PostgreSQL documentation`__ for additional details
  
  __ https://www.postgresql.org/docs/current/sql-createdomain.html
  
  .. versionadded:: 2.0
class_docstr_tok: ["Represent","the","DOMAIN","PostgreSQL","type",".","A","domain","is","essentially","a","data","type","with","optional","constraints","that","restrict","the","allowed","set","of","values",".","E.g",".",":",":","PositiveInt","=","DOMAIN","(","``","pos_int","''",",","Integer",",","check=","''","VALUE",">","0","''",",","not_null=True",")","UsPostalCode","=","DOMAIN","(","``","us_postal_code","''",",","Text",",","check=","''","VALUE","~","'^\\d","{","5","}","$","'","OR","VALUE","~","'^\\d","{","5","}","-\\d","{","4","}","$","'","''",")","See","the","`","PostgreSQL","documentation","`","__","for","additional","details","__","https",":","\/\/www.postgresql.org\/docs\/current\/sql-createdomain.html","..","versionadded",":",":","2.0"]
docstr: Construct a DOMAIN.
  
  :param name: the name of the domain
  :param data_type: The underlying data type of the domain.
    This can include array specifiers.
  :param collation: An optional collation for the domain.
    If no collation is specified, the underlying data type's default
    collation is used. The underlying type must be collatable if
    ``collation`` is specified.
  :param default: The DEFAULT clause specifies a default value for
    columns of the domain data type. The default should be a string
    or a :func:`_expression.text` value.
    If no default value is specified, then the default value is
    the null value.
  :param constraint_name: An optional name for a constraint.
    If not specified, the backend generates a name.
  :param not_null: Values of this domain are prevented from being null.
    By default domain are allowed to be null. If not specified
    no nullability clause will be emitted.
  :param check: CHECK clause specify integrity constraint or test
    which values of the domain must satisfy. A constraint must be
    an expression producing a Boolean result that can use the key
    word VALUE to refer to the value being tested.
    Differently from PostgreSQL, only a single check clause is
    currently allowed in SQLAlchemy.
  :param schema: optional schema name
  :param metadata: optional :class:`_schema.MetaData` object which
   this :class:`_postgresql.DOMAIN` will be directly associated
  :param create_type: Defaults to True.
   Indicates that ``CREATE TYPE`` should be emitted, after optionally
   checking for the presence of the type, when the parent table is
   being created; and additionally that ``DROP TYPE`` is called
   when the table is dropped.
docstr_tok: ["Construct","a","DOMAIN",".",":","param","name",":","the","name","of","the","domain",":","param","data_type",":","The","underlying","data","type","of","the","domain",".","This","can","include","array","specifiers",".",":","param","collation",":","An","optional","collation","for","the","domain",".","If","no","collation","is","specified",",","the","underlying","data","type","'s","default","collation","is","used",".","The","underlying","type","must","be","collatable","if","``","collation","``","is","specified",".",":","param","default",":","The","DEFAULT","clause","specifies","a","default","value","for","columns","of","the","domain","data","type",".","The","default","should","be","a","string","or","a",":","func",":","`","_expression.text","`","value",".","If","no","default","value","is","specified",",","then","the","default","value","is","the","null","value",".",":","param","constraint_name",":","An","optional","name","for","a","constraint",".","If","not","specified",",","the","backend","generates","a","name",".",":","param","not_null",":","Values","of","this","domain","are","prevented","from","being","null",".","By","default","domain","are","allowed","to","be","null",".","If","not","specified","no","nullability","clause","will","be","emitted",".",":","param","check",":","CHECK","clause","specify","integrity","constraint","or","test","which","values","of","the","domain","must","satisfy",".","A","constraint","must","be","an","expression","producing","a","Boolean","result","that","can","use","the","key","word","VALUE","to","refer","to","the","value","being","tested",".","Differently","from","PostgreSQL",",","only","a","single","check","clause","is","currently","allowed","in","SQLAlchemy",".",":","param","schema",":","optional","schema","name",":","param","metadata",":","optional",":","class",":","`","_schema.MetaData","`","object","which","this",":","class",":","`","_postgresql.DOMAIN","`","will","be","directly","associated",":","param","create_type",":","Defaults","to","True",".","Indicates","that","``","CREATE","TYPE","``","should","be","emitted",",","after","optionally","checking","for","the","presence","of","the","type",",","when","the","parent","table","is","being","created",";","and","additionally","that","``","DROP","TYPE","``","is","called","when","the","table","is","dropped","."]
code: def __init__(
      self,
      name: str,
      data_type: _TypeEngineArgument[Any],
      *,
      collation: Optional[str] = None,
      default: Optional[Union[str, elements.TextClause]] = None,
      constraint_name: Optional[str] = None,
      not_null: Optional[bool] = None,
      check: Optional[str] = None,
      create_type: bool = True,
      **kw: Any,
  ):
      """
      Construct a DOMAIN.
  
      :param name: the name of the domain
      :param data_type: The underlying data type of the domain.
        This can include array specifiers.
      :param collation: An optional collation for the domain.
        If no collation is specified, the underlying data type's default
        collation is used. The underlying type must be collatable if
        ``collation`` is specified.
      :param default: The DEFAULT clause specifies a default value for
        columns of the domain data type. The default should be a string
        or a :func:`_expression.text` value.
        If no default value is specified, then the default value is
        the null value.
      :param constraint_name: An optional name for a constraint.
        If not specified, the backend generates a name.
      :param not_null: Values of this domain are prevented from being null.
        By default domain are allowed to be null. If not specified
        no nullability clause will be emitted.
      :param check: CHECK clause specify integrity constraint or test
        which values of the domain must satisfy. A constraint must be
        an expression producing a Boolean result that can use the key
        word VALUE to refer to the value being tested.
        Differently from PostgreSQL, only a single check clause is
        currently allowed in SQLAlchemy.
      :param schema: optional schema name
      :param metadata: optional :class:`_schema.MetaData` object which
       this :class:`_postgresql.DOMAIN` will be directly associated
      :param create_type: Defaults to True.
       Indicates that ``CREATE TYPE`` should be emitted, after optionally
       checking for the presence of the type, when the parent table is
       being created; and additionally that ``DROP TYPE`` is called
       when the table is dropped.
  
      """
      self.data_type = type_api.to_instance(data_type)
      self.default = default
      self.collation = collation
      self.constraint_name = constraint_name
      self.not_null = not_null
      if check is not None:
          check = coercions.expect(roles.DDLExpressionRole, check)
      self.check = check
      self.create_type = create_type
      super().__init__(name=name, **kw)
  
imports: from __future__ import annotations
  from typing import Any
  from typing import Optional
  from typing import Type
  from typing import TYPE_CHECKING
  from typing import Union
  from ...None import schema
  from ...None import util
  from ...sql import coercions
  from ...sql import elements
  from ...sql import roles
  from ...sql import sqltypes
  from ...sql import type_api
  from ...sql.base import _NoArg
  from ...sql.ddl import InvokeCreateDDLBase
  from ...sql.ddl import InvokeDropDDLBase
label_desc: Use image node_id 1 to create a new DOMAIN object from inherited base classes: NamedType, sqltypes with example: obj = DOMAIN(name, data_type)