MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / false

Function false

lib/sqlalchemy/sql/_elements_constructors.py:1223–1260  ·  view source on GitHub ↗

Return a :class:`.False_` construct. E.g.: .. sourcecode:: pycon+sql >>> from sqlalchemy import false >>> print(select(t.c.x).where(false())) {printsql}SELECT x FROM t WHERE false A backend which does not support true/false constants will render as an expr

()

Source from the content-addressed store, hash-verified

1221
1222
1223def false() -> False_:
1224 """Return a :class:`.False_` construct.
1225
1226 E.g.:
1227
1228 .. sourcecode:: pycon+sql
1229
1230 >>> from sqlalchemy import false
1231 >>> print(select(t.c.x).where(false()))
1232 {printsql}SELECT x FROM t WHERE false
1233
1234 A backend which does not support true/false constants will render as
1235 an expression against 1 or 0:
1236
1237 .. sourcecode:: pycon+sql
1238
1239 >>> print(select(t.c.x).where(false()))
1240 {printsql}SELECT x FROM t WHERE 0 = 1
1241
1242 The :func:`.true` and :func:`.false` constants also feature
1243 "short circuit" operation within an :func:`.and_` or :func:`.or_`
1244 conjunction:
1245
1246 .. sourcecode:: pycon+sql
1247
1248 >>> print(select(t.c.x).where(or_(t.c.x > 5, true())))
1249 {printsql}SELECT x FROM t WHERE true{stop}
1250
1251 >>> print(select(t.c.x).where(and_(t.c.x > 5, false())))
1252 {printsql}SELECT x FROM t WHERE false{stop}
1253
1254 .. seealso::
1255
1256 :func:`.true`
1257
1258 """
1259
1260 return False_._instance()
1261
1262
1263def funcfilter(

Callers 15

test_sixMethod · 0.90
test_seven_bMethod · 0.90
test_seven_dMethod · 0.90
test_eightMethod · 0.90
test_nineMethod · 0.90
test_single_bool_fourMethod · 0.90
test_single_bool_sixMethod · 0.90
test_eightMethod · 0.90
test_nineMethod · 0.90

Calls 1

_instanceMethod · 0.45

Tested by 15

test_sixMethod · 0.72
test_seven_bMethod · 0.72
test_seven_dMethod · 0.72
test_eightMethod · 0.72
test_nineMethod · 0.72
test_single_bool_fourMethod · 0.72
test_single_bool_sixMethod · 0.72
test_eightMethod · 0.72
test_nineMethod · 0.72