class documentation

class TypeEngine(Visitable, Generic[_T]): (source)

Known subclasses: sqlalchemy.dialects.mssql.MONEY, sqlalchemy.dialects.mssql.SMALLMONEY, sqlalchemy.dialects.mssql.SQL_VARIANT, sqlalchemy.dialects.mysql.BIT, sqlalchemy.dialects.mysql.YEAR, sqlalchemy.dialects.oracle.ROWID, sqlalchemy.dialects.postgresql.BIT, sqlalchemy.dialects.postgresql.CIDR, sqlalchemy.dialects.postgresql.hstore.HSTORE, sqlalchemy.dialects.postgresql.INET, sqlalchemy.dialects.postgresql.MACADDR, sqlalchemy.dialects.postgresql.MACADDR8, sqlalchemy.dialects.postgresql.MONEY, sqlalchemy.dialects.postgresql.NamedType, sqlalchemy.dialects.postgresql.OID, sqlalchemy.dialects.postgresql.ranges.AbstractRange, sqlalchemy.dialects.postgresql.REGCLASS, sqlalchemy.dialects.postgresql.REGCONFIG, sqlalchemy.dialects.postgresql.TSQUERY, sqlalchemy.dialects.postgresql.TSVECTOR, sqlalchemy.sql.sqltypes.ARRAY, sqlalchemy.sql.sqltypes.Boolean, sqlalchemy.sql.sqltypes.Date, sqlalchemy.sql.sqltypes.DateTime, sqlalchemy.sql.sqltypes.Enum, sqlalchemy.sql.sqltypes.Integer, sqlalchemy.sql.sqltypes.JSON, sqlalchemy.sql.sqltypes.JSON.JSONElementType, sqlalchemy.sql.sqltypes.NullType, sqlalchemy.sql.sqltypes.Numeric, sqlalchemy.sql.sqltypes.String, sqlalchemy.sql.sqltypes.TableValueType, sqlalchemy.sql.sqltypes.Time, sqlalchemy.sql.sqltypes.TupleType, sqlalchemy.sql.sqltypes.Uuid, sqlalchemy.sql.type_api.TypeDecorator, sqlalchemy.sql.type_api.UserDefinedType, sqlalchemy.sql.sqltypes._AbstractInterval, sqlalchemy.sql.sqltypes._Binary

View In Hierarchy

The ultimate base class for all SQL datatypes. Common subclasses of :class:`.TypeEngine` include :class:`.String`, :class:`.Integer`, and :class:`.Boolean`. For an overview of the SQLAlchemy typing system, see :ref:`types_toplevel`. .. seealso:: :ref:`types_toplevel`

Class Comparator Base class for custom comparison operations defined at the type level. See :attr:`.TypeEngine.comparator_factory`.
Method __repr__ Undocumented
Method __str__ Undocumented
Method adapt Produce an "adapted" form of this type, given an "impl" class to work with.
Method as_generic Return an instance of the generic type corresponding to this type using heuristic rule. The method may be overridden if this heuristic rule is not sufficient.
Method bind_expression Given a bind value (i.e. a :class:`.BindParameter` instance), return a SQL expression in its place.
Method bind_processor Return a conversion function for processing bind values.
Method coerce_compared_value Suggest a type for a 'coerced' Python value in an expression.
Method column_expression Given a SELECT column expression, return a wrapping SQL expression.
Method compare_against_backend Compare this type against the given backend type.
Method compare_values Compare two values for equality.
Method compile Produce a string-compiled form of this :class:`.TypeEngine`.
Method copy Undocumented
Method copy_value Undocumented
Method dialect_impl Return a dialect-specific implementation for this :class:`.TypeEngine`.
Method evaluates_none Return a copy of this type which has the :attr:`.should_evaluate_none` flag set to True.
Method get_dbapi_type Return the corresponding type object from the underlying DB-API, if any.
Method literal_processor Return a conversion function for processing literal values that are to be rendered directly without using binds.
Method result_processor Return a conversion function for processing result row values.
Method with_variant Produce a copy of this type object that will utilize the given type when applied to the dialect of the given name.
Class Variable hashable Flag, if False, means values from this type aren't hashable.
Class Variable render_bind_cast Render bind casts for :attr:`.BindTyping.RENDER_CASTS` mode.
Class Variable render_literal_cast render casts when rendering a value as an inline literal, e.g. with :meth:`.TypeEngine.literal_processor`.
Class Variable should_evaluate_none If True, the Python constant ``None`` is considered to be handled explicitly by this type.
Class Variable sort_key_function A sorting function that can be passed as the key to sorted.
Property python_type Return the Python type object expected to be returned by instances of this type, if known.
Static Method _to_instance Undocumented
Method _cached_bind_processor Return a dialect-specific bind processor for this type.
Method _cached_custom_processor return a dialect-specific processing object for custom purposes.
Method _cached_literal_processor Return a dialect-specific literal processor for this type.
Method _cached_result_processor Return a dialect-specific result processor for this type.
Method _compare_type_affinity Undocumented
Method _default_dialect Undocumented
Method _dialect_info Return a dialect-specific registry which caches a dialect-specific implementation, bind processing function, and one or more result processing functions.
Method _gen_dialect_impl Undocumented
Method _resolve_for_literal adjust this type given a literal Python value that will be stored in a bound parameter.
Method _resolve_for_python_type given a Python type (e.g. ``int``, ``str``, etc. ) return an instance of this :class:`.TypeEngine` that's appropriate for this type.
Method _unwrapped_dialect_impl Return the 'unwrapped' dialect impl for this type.
Class Variable _is_array Undocumented
Class Variable _is_table_value Undocumented
Class Variable _is_tuple_type Undocumented
Class Variable _is_type_decorator Undocumented
Class Variable _isnull Undocumented
Class Variable _sqla_type Undocumented
Property _generic_type_affinity Undocumented
Property _has_bind_expression memoized boolean, check if bind_expression is implemented.
Property _has_column_expression memoized boolean, check if column_expression is implemented.
Property _static_cache_key Undocumented
Property _type_affinity Return a rudimental 'affinity' value expressing the general class of type.

Inherited from Visitable:

Method __class_getitem__ Undocumented
Method __init_subclass__ Undocumented
Class Variable __slots__ Undocumented
Class Variable __visit_name__ Undocumented
Class Method _generate_compiler_dispatch Undocumented
Method _compiler_dispatch Undocumented
Class Variable _original_compiler_dispatch Undocumented
def __str__(self) -> str: (source)

Undocumented

@overload
def adapt(self, cls: Type[_TE], **kw: Any) -> _TE:
@overload
def adapt(self, cls: Type[TypeEngineMixin], **kw: Any) -> TypeEngine[Any]:
(source)

Produce an "adapted" form of this type, given an "impl" class to work with. This method is used internally to associate generic types with "implementation" types that are specific to a particular dialect.

def as_generic(self, allow_nulltype: bool = False) -> TypeEngine[_T]: (source)

Return an instance of the generic type corresponding to this type using heuristic rule. The method may be overridden if this heuristic rule is not sufficient. >>> from sqlalchemy.dialects.mysql import INTEGER >>> INTEGER(display_width=4).as_generic() Integer() >>> from sqlalchemy.dialects.mysql import NVARCHAR >>> NVARCHAR(length=100).as_generic() Unicode(length=100) .. versionadded:: 1.4.0b2 .. seealso:: :ref:`metadata_reflection_dbagnostic_types` - describes the use of :meth:`_types.TypeEngine.as_generic` in conjunction with the :meth:`_sql.DDLEvents.column_reflect` event, which is its intended use.

def bind_expression(self, bindvalue: BindParameter[_T]) -> Optional[ColumnElement[_T]]: (source)

Given a bind value (i.e. a :class:`.BindParameter` instance), return a SQL expression in its place. This is typically a SQL function that wraps the existing bound parameter within the statement. It is used for special data types that require literals being wrapped in some special database function in order to coerce an application-level value into a database-specific format. It is the SQL analogue of the :meth:`.TypeEngine.bind_processor` method. This method is called during the **SQL compilation** phase of a statement, when rendering a SQL string. It is **not** called against specific values. Note that this method, when implemented, should always return the exact same structure, without any conditional logic, as it may be used in an executemany() call against an arbitrary number of bound parameter sets. .. note:: This method is only called relative to a **dialect specific type object**, which is often **private to a dialect in use** and is not the same type object as the public facing one, which means it's not feasible to subclass a :class:`.types.TypeEngine` class in order to provide an alternate :meth:`_types.TypeEngine.bind_expression` method, unless subclassing the :class:`_types.UserDefinedType` class explicitly. To provide alternate behavior for :meth:`_types.TypeEngine.bind_expression`, implement a :class:`_types.TypeDecorator` class and provide an implementation of :meth:`_types.TypeDecorator.bind_expression`. .. seealso:: :ref:`types_typedecorator` .. seealso:: :ref:`types_sql_value_processing`

def bind_processor(self, dialect: Dialect) -> Optional[_BindProcessorType[_T]]: (source)

Return a conversion function for processing bind values. Returns a callable which will receive a bind parameter value as the sole positional argument and will return a value to send to the DB-API. If processing is not necessary, the method should return ``None``. .. note:: This method is only called relative to a **dialect specific type object**, which is often **private to a dialect in use** and is not the same type object as the public facing one, which means it's not feasible to subclass a :class:`.types.TypeEngine` class in order to provide an alternate :meth:`_types.TypeEngine.bind_processor` method, unless subclassing the :class:`_types.UserDefinedType` class explicitly. To provide alternate behavior for :meth:`_types.TypeEngine.bind_processor`, implement a :class:`_types.TypeDecorator` class and provide an implementation of :meth:`_types.TypeDecorator.process_bind_param`. .. seealso:: :ref:`types_typedecorator` :param dialect: Dialect instance in use.

def coerce_compared_value(self, op: Optional[OperatorType], value: Any) -> TypeEngine[Any]: (source)

Suggest a type for a 'coerced' Python value in an expression. Given an operator and value, gives the type a chance to return a type which the value should be coerced into. The default behavior here is conservative; if the right-hand side is already coerced into a SQL type based on its Python type, it is usually left alone. End-user functionality extension here should generally be via :class:`.TypeDecorator`, which provides more liberal behavior in that it defaults to coercing the other side of the expression into this type, thus applying special Python conversions above and beyond those needed by the DBAPI to both ides. It also provides the public method :meth:`.TypeDecorator.coerce_compared_value` which is intended for end-user customization of this behavior.

def column_expression(self, colexpr: ColumnElement[_T]) -> Optional[ColumnElement[_T]]: (source)

Given a SELECT column expression, return a wrapping SQL expression. This is typically a SQL function that wraps a column expression as rendered in the columns clause of a SELECT statement. It is used for special data types that require columns to be wrapped in some special database function in order to coerce the value before being sent back to the application. It is the SQL analogue of the :meth:`.TypeEngine.result_processor` method. This method is called during the **SQL compilation** phase of a statement, when rendering a SQL string. It is **not** called against specific values. .. note:: This method is only called relative to a **dialect specific type object**, which is often **private to a dialect in use** and is not the same type object as the public facing one, which means it's not feasible to subclass a :class:`.types.TypeEngine` class in order to provide an alternate :meth:`_types.TypeEngine.column_expression` method, unless subclassing the :class:`_types.UserDefinedType` class explicitly. To provide alternate behavior for :meth:`_types.TypeEngine.column_expression`, implement a :class:`_types.TypeDecorator` class and provide an implementation of :meth:`_types.TypeDecorator.column_expression`. .. seealso:: :ref:`types_typedecorator` .. seealso:: :ref:`types_sql_value_processing`

def compare_against_backend(self, dialect: Dialect, conn_type: TypeEngine[Any]) -> Optional[bool]: (source)

Compare this type against the given backend type. This function is currently not implemented for SQLAlchemy types, and for all built in types will return ``None``. However, it can be implemented by a user-defined type where it can be consumed by schema comparison tools such as Alembic autogenerate. A future release of SQLAlchemy will potentially implement this method for builtin types as well. The function should return True if this type is equivalent to the given type; the type is typically reflected from the database so should be database specific. The dialect in use is also passed. It can also return False to assert that the type is not equivalent. :param dialect: a :class:`.Dialect` that is involved in the comparison. :param conn_type: the type object reflected from the backend. .. versionadded:: 1.0.3

def compare_values(self, x: Any, y: Any) -> bool: (source)

Compare two values for equality.

def compile(self, dialect: Optional[Dialect] = None) -> str: (source)

Produce a string-compiled form of this :class:`.TypeEngine`. When called with no arguments, uses a "default" dialect to produce a string result. :param dialect: a :class:`.Dialect` instance.

def copy_value(self, value: Any) -> Any: (source)

Undocumented

def dialect_impl(self, dialect: Dialect) -> TypeEngine[_T]: (source)

Return a dialect-specific implementation for this :class:`.TypeEngine`.

def evaluates_none(self) -> Self: (source)

Return a copy of this type which has the :attr:`.should_evaluate_none` flag set to True. E.g.:: Table( 'some_table', metadata, Column( String(50).evaluates_none(), nullable=True, server_default='no value') ) The ORM uses this flag to indicate that a positive value of ``None`` is passed to the column in an INSERT statement, rather than omitting the column from the INSERT statement which has the effect of firing off column-level defaults. It also allows for types which have special behavior associated with the Python None value to indicate that the value doesn't necessarily translate into SQL NULL; a prime example of this is a JSON type which may wish to persist the JSON value ``'null'``. In all cases, the actual NULL SQL value can be always be persisted in any column by using the :obj:`_expression.null` SQL construct in an INSERT statement or associated with an ORM-mapped attribute. .. note:: The "evaluates none" flag does **not** apply to a value of ``None`` passed to :paramref:`_schema.Column.default` or :paramref:`_schema.Column.server_default`; in these cases, ``None`` still means "no default". .. versionadded:: 1.1 .. seealso:: :ref:`session_forcing_null` - in the ORM documentation :paramref:`.postgresql.JSON.none_as_null` - PostgreSQL JSON interaction with this flag. :attr:`.TypeEngine.should_evaluate_none` - class-level flag

def literal_processor(self, dialect: Dialect) -> Optional[_LiteralProcessorType[_T]]: (source)

Return a conversion function for processing literal values that are to be rendered directly without using binds. This function is used when the compiler makes use of the "literal_binds" flag, typically used in DDL generation as well as in certain scenarios where backends don't accept bound parameters. Returns a callable which will receive a literal Python value as the sole positional argument and will return a string representation to be rendered in a SQL statement. .. note:: This method is only called relative to a **dialect specific type object**, which is often **private to a dialect in use** and is not the same type object as the public facing one, which means it's not feasible to subclass a :class:`.types.TypeEngine` class in order to provide an alternate :meth:`_types.TypeEngine.literal_processor` method, unless subclassing the :class:`_types.UserDefinedType` class explicitly. To provide alternate behavior for :meth:`_types.TypeEngine.literal_processor`, implement a :class:`_types.TypeDecorator` class and provide an implementation of :meth:`_types.TypeDecorator.process_literal_param`. .. seealso:: :ref:`types_typedecorator`

def result_processor(self, dialect: Dialect, coltype: object) -> Optional[_ResultProcessorType[_T]]: (source)

Return a conversion function for processing result row values. Returns a callable which will receive a result row column value as the sole positional argument and will return a value to return to the user. If processing is not necessary, the method should return ``None``. .. note:: This method is only called relative to a **dialect specific type object**, which is often **private to a dialect in use** and is not the same type object as the public facing one, which means it's not feasible to subclass a :class:`.types.TypeEngine` class in order to provide an alternate :meth:`_types.TypeEngine.result_processor` method, unless subclassing the :class:`_types.UserDefinedType` class explicitly. To provide alternate behavior for :meth:`_types.TypeEngine.result_processor`, implement a :class:`_types.TypeDecorator` class and provide an implementation of :meth:`_types.TypeDecorator.process_result_value`. .. seealso:: :ref:`types_typedecorator` :param dialect: Dialect instance in use. :param coltype: DBAPI coltype argument received in cursor.description.

def with_variant(self, type_: _TypeEngineArgument[Any], *dialect_names: str) -> Self: (source)

Produce a copy of this type object that will utilize the given type when applied to the dialect of the given name. e.g.:: from sqlalchemy.types import String from sqlalchemy.dialects import mysql string_type = String() string_type = string_type.with_variant( mysql.VARCHAR(collation='foo'), 'mysql', 'mariadb' ) The variant mapping indicates that when this type is interpreted by a specific dialect, it will instead be transmuted into the given type, rather than using the primary type. .. versionchanged:: 2.0 the :meth:`_types.TypeEngine.with_variant` method now works with a :class:`_types.TypeEngine` object "in place", returning a copy of the original type rather than returning a wrapping object; the ``Variant`` class is no longer used. :param type\_: a :class:`.TypeEngine` that will be selected as a variant from the originating type, when a dialect of the given name is in use. :param \*dialect_names: one or more base names of the dialect which uses this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.) .. versionchanged:: 2.0 multiple dialect names can be specified for one variant. .. seealso:: :ref:`types_with_variant` - illustrates the use of :meth:`_types.TypeEngine.with_variant`.

hashable: bool = (source)

Flag, if False, means values from this type aren't hashable. Used by the ORM when uniquing result lists.

render_bind_cast: bool = (source)
overridden in sqlalchemy.dialects.postgresql.asyncpg.AsyncpgBigInteger, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgBoolean, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgCHAR, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgDate, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgDateTime, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgInteger, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgJSON, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgJSONB, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgJSONIntIndexType, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgJSONStrIndexType, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgNumeric, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgString, sqlalchemy.dialects.postgresql.asyncpg.AsyncpgTime, sqlalchemy.dialects.postgresql.ranges.AbstractRange, sqlalchemy.dialects.postgresql.types.PGUuid, sqlalchemy.dialects.postgresql._psycopg_common._PsycopgARRAY, sqlalchemy.dialects.postgresql.pg8000._PGARRAY, sqlalchemy.dialects.postgresql.pg8000._PGBigInteger, sqlalchemy.dialects.postgresql.pg8000._PGBoolean, sqlalchemy.dialects.postgresql.pg8000._PGDate, sqlalchemy.dialects.postgresql.pg8000._PGInteger, sqlalchemy.dialects.postgresql.pg8000._PGJSON, sqlalchemy.dialects.postgresql.pg8000._PGJSONB, sqlalchemy.dialects.postgresql.pg8000._PGJSONIntIndexType, sqlalchemy.dialects.postgresql.pg8000._PGJSONStrIndexType, sqlalchemy.dialects.postgresql.pg8000._PGNumeric, sqlalchemy.dialects.postgresql.pg8000._PGSmallInteger, sqlalchemy.dialects.postgresql.pg8000._PGString, sqlalchemy.dialects.postgresql.pg8000._PGTime, sqlalchemy.dialects.postgresql.pg8000._PGTimeStamp, sqlalchemy.dialects.postgresql.psycopg._PGBigInteger, sqlalchemy.dialects.postgresql.psycopg._PGBoolean, sqlalchemy.dialects.postgresql.psycopg._PGDate, sqlalchemy.dialects.postgresql.psycopg._PGInteger, sqlalchemy.dialects.postgresql.psycopg._PGJSON, sqlalchemy.dialects.postgresql.psycopg._PGJSONB, sqlalchemy.dialects.postgresql.psycopg._PGJSONIntIndexType, sqlalchemy.dialects.postgresql.psycopg._PGJSONStrIndexType, sqlalchemy.dialects.postgresql.psycopg._PGNullType, sqlalchemy.dialects.postgresql.psycopg._PGSmallInteger, sqlalchemy.dialects.postgresql.psycopg._PGString, sqlalchemy.dialects.postgresql.psycopg._PGTime, sqlalchemy.dialects.postgresql.psycopg._PGTimeStamp

Render bind casts for :attr:`.BindTyping.RENDER_CASTS` mode. If True, this type (usually a dialect level impl type) signals to the compiler that a cast should be rendered around a bound parameter for this type. .. versionadded:: 2.0 .. seealso:: :class:`.BindTyping`

render_literal_cast: bool = (source)

render casts when rendering a value as an inline literal, e.g. with :meth:`.TypeEngine.literal_processor`. .. versionadded:: 2.0

should_evaluate_none: bool = (source)

If True, the Python constant ``None`` is considered to be handled explicitly by this type. The ORM uses this flag to indicate that a positive value of ``None`` is passed to the column in an INSERT statement, rather than omitting the column from the INSERT statement which has the effect of firing off column-level defaults. It also allows types which have special behavior for Python None, such as a JSON type, to indicate that they'd like to handle the None value explicitly. To set this flag on an existing type, use the :meth:`.TypeEngine.evaluates_none` method. .. seealso:: :meth:`.TypeEngine.evaluates_none` .. versionadded:: 1.1

sort_key_function: Optional[Callable[[Any], Any]] = (source)

A sorting function that can be passed as the key to sorted. The default value of ``None`` indicates that the values stored by this type are self-sorting. .. versionadded:: 1.3.8

Return the Python type object expected to be returned by instances of this type, if known. Basically, for those types which enforce a return type, or are known across the board to do such for all common DBAPIs (like ``int`` for example), will return that type. If a return type is not defined, raises ``NotImplementedError``. Note that any type also accommodates NULL in SQL which means you can also get back ``None`` from any type in practice.

@staticmethod
def _to_instance(cls_or_self: Union[Type[_TE], _TE]) -> _TE: (source)

Undocumented

def _cached_bind_processor(self, dialect: Dialect) -> Optional[_BindProcessorType[_T]]: (source)

Return a dialect-specific bind processor for this type.

def _cached_custom_processor(self, dialect: Dialect, key: str, fn: Callable[[TypeEngine[_T]], _O]) -> _O: (source)

return a dialect-specific processing object for custom purposes. The cx_Oracle dialect uses this at the moment.

def _cached_literal_processor(self, dialect: Dialect) -> Optional[_LiteralProcessorType[_T]]: (source)

Return a dialect-specific literal processor for this type.

def _cached_result_processor(self, dialect: Dialect, coltype: Any) -> Optional[_ResultProcessorType[_T]]: (source)

Return a dialect-specific result processor for this type.

def _compare_type_affinity(self, other: TypeEngine[Any]) -> bool: (source)

Undocumented

@util.preload_module('sqlalchemy.engine.default')
def _default_dialect(self) -> Dialect: (source)

Undocumented

def _dialect_info(self, dialect: Dialect) -> _TypeMemoDict: (source)

Return a dialect-specific registry which caches a dialect-specific implementation, bind processing function, and one or more result processing functions.

def _gen_dialect_impl(self, dialect: Dialect) -> TypeEngine[Any]: (source)

Undocumented

def _resolve_for_literal(self, value: Any) -> Self: (source)

adjust this type given a literal Python value that will be stored in a bound parameter. Used exclusively by _resolve_value_to_type(). .. versionadded:: 1.4.30 or 2.0 TODO: this should be part of public API .. seealso:: :meth:`.TypeEngine._resolve_for_python_type`

def _resolve_for_python_type(self, python_type: Type[Any], matched_on: _MatchedOnType, matched_on_flattened: Type[Any]) -> Optional[Self]: (source)

given a Python type (e.g. ``int``, ``str``, etc. ) return an instance of this :class:`.TypeEngine` that's appropriate for this type. An additional argument ``matched_on`` is passed, which indicates an entry from the ``__mro__`` of the given ``python_type`` that more specifically matches how the caller located this :class:`.TypeEngine` object. Such as, if a lookup of some kind links the ``int`` Python type to the :class:`.Integer` SQL type, and the original object was some custom subclass of ``int`` such as ``MyInt(int)``, the arguments passed would be ``(MyInt, int)``. If the given Python type does not correspond to this :class:`.TypeEngine`, or the Python type is otherwise ambiguous, the method should return None. For simple cases, the method checks that the ``python_type`` and ``matched_on`` types are the same (i.e. not a subclass), and returns self; for all other cases, it returns ``None``. The initial use case here is for the ORM to link user-defined Python standard library ``enum.Enum`` classes to the SQLAlchemy :class:`.Enum` SQL type when constructing ORM Declarative mappings. :param python_type: the Python type we want to use :param matched_on: the Python type that led us to choose this particular :class:`.TypeEngine` class, which would be a supertype of ``python_type``. By default, the request is rejected if ``python_type`` doesn't match ``matched_on`` (None is returned). .. versionadded:: 2.0.0b4 TODO: this should be part of public API .. seealso:: :meth:`.TypeEngine._resolve_for_literal`

def _unwrapped_dialect_impl(self, dialect: Dialect) -> TypeEngine[_T]: (source)

Return the 'unwrapped' dialect impl for this type. For a type that applies wrapping logic (e.g. TypeDecorator), give us the real, actual dialect-level type that is used. This is used by TypeDecorator itself as well at least one case where dialects need to check that a particular specific dialect-level type is in use, within the :meth:`.DefaultDialect.set_input_sizes` method.

_is_array: bool = (source)

Undocumented

_is_table_value: bool = (source)

Undocumented

_is_tuple_type: bool = (source)

Undocumented

_is_type_decorator: bool = (source)

Undocumented

Undocumented

_sqla_type: bool = (source)

Undocumented

@util.ro_memoized_property
_generic_type_affinity: Type[TypeEngine[_T]] = (source)

Undocumented

@util.memoized_property
_has_bind_expression: bool = (source)

memoized boolean, check if bind_expression is implemented. Allows the method to be skipped for the vast majority of expression types that don't use this feature.

@util.memoized_property
_has_column_expression: bool = (source)

memoized boolean, check if column_expression is implemented. Allows the method to be skipped for the vast majority of expression types that don't use this feature.

@util.memoized_property
_static_cache_key: Union[CacheConst, Tuple[Any, ...]] = (source)

Undocumented

@util.ro_memoized_property
_type_affinity: Optional[Type[TypeEngine[_T]]] = (source)

Return a rudimental 'affinity' value expressing the general class of type.