Skip to content

Commit e9d3e49

Browse files
committed
ensure intro to "functions have types" is not misleading
make sure it's clear that there is normally not a return type for SQL functions Fixes: sqlalchemy#11578 Change-Id: Ia0b66e7fe685dad427822345dd232eb47a0fc44f
1 parent 7b93664 commit e9d3e49

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

doc/build/tutorial/data_select.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,11 +1410,18 @@ as opposed to the "return type" of a Python function.
14101410

14111411
The SQL return type of any SQL function may be accessed, typically for
14121412
debugging purposes, by referring to the :attr:`_functions.Function.type`
1413-
attribute::
1413+
attribute; this will be pre-configured for a **select few** of extremely
1414+
common SQL functions, but for most SQL functions is the "null" datatype
1415+
if not otherwise specified::
14141416

1417+
>>> # pre-configured SQL function (only a few dozen of these)
14151418
>>> func.now().type
14161419
DateTime()
14171420

1421+
>>> # arbitrary SQL function (all other SQL functions)
1422+
>>> func.run_some_calculation().type
1423+
NullType()
1424+
14181425
These SQL return types are significant when making
14191426
use of the function expression in the context of a larger expression; that is,
14201427
math operators will work better when the datatype of the expression is

0 commit comments

Comments
 (0)