From e03f7ab50e69ffce67585cdc7a0cb7a3cc5c0cc1 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 4 Jul 2019 11:16:50 -0400 Subject: Add tutorial section for cast(), type_coerce() Change-Id: I49f635f0ad4d07abe8ef2681c9660ec7fcf5f99b --- lib/sqlalchemy/sql/elements.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql/elements.py') diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 22799dab5..b902ef4b4 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -859,6 +859,14 @@ class ColumnElement( This is a shortcut to the :func:`~.expression.cast` function. + .. seealso:: + + :ref:`coretutorial_casts` + + :func:`~.expression.cast` + + :func:`~.expression.type_coerce` + .. versionadded:: 1.0.7 """ @@ -2458,8 +2466,14 @@ class Cast(ColumnElement): .. seealso:: + :ref:`coretutorial_casts` + :func:`.cast` + :func:`.type_coerce` - an alternative to CAST that coerces the type + on the Python side only, which is often sufficient to generate the + correct SQL and data coercion. + """ __visit_name__ = "cast" @@ -2509,8 +2523,12 @@ class Cast(ColumnElement): .. seealso:: - :func:`.type_coerce` - Python-side type coercion without emitting - CAST. + :ref:`coretutorial_casts` + + :func:`.type_coerce` - an alternative to CAST that coerces the type + on the Python side only, which is often sufficient to generate the + correct SQL and data coercion. + """ self.type = type_api.to_instance(type_) @@ -2552,6 +2570,8 @@ class TypeCoerce(ColumnElement): :func:`.expression.type_coerce` + :func:`.cast` + """ __visit_name__ = "type_coerce" @@ -2614,6 +2634,8 @@ class TypeCoerce(ColumnElement): .. seealso:: + :ref:`coretutorial_casts` + :func:`.cast` """ -- cgit v1.2.1