From: krave1986 Date: Thu, 3 Apr 2025 18:55:36 +0000 (+0800) Subject: docs: Fix substr function starting index in hybrid_property example (#12482) X-Git-Tag: rel_2_0_41~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b74d6ca27de18dd5436a32fbeeef8e072845f040;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git docs: Fix substr function starting index in hybrid_property example (#12482) (cherry picked from commit 0c1824c666c55ae19051feb4970060385c674bb3) --- diff --git a/doc/build/orm/mapped_attributes.rst b/doc/build/orm/mapped_attributes.rst index d0610f4e0f..b114680132 100644 --- a/doc/build/orm/mapped_attributes.rst +++ b/doc/build/orm/mapped_attributes.rst @@ -234,7 +234,7 @@ logic:: """Produce a SQL expression that represents the value of the _email column, minus the last twelve characters.""" - return func.substr(cls._email, 0, func.length(cls._email) - 12) + return func.substr(cls._email, 1, func.length(cls._email) - 12) Above, accessing the ``email`` property of an instance of ``EmailAddress`` will return the value of the ``_email`` attribute, removing or adding the @@ -249,7 +249,7 @@ attribute, a SQL function is rendered which produces the same effect: {execsql}SELECT address.email AS address_email, address.id AS address_id FROM address WHERE substr(address.email, ?, length(address.email) - ?) = ? - (0, 12, 'address') + (1, 12, 'address') {stop} Read more about Hybrids at :ref:`hybrids_toplevel`.