Return a constant :class:`.True_` construct. E.g.: .. sourcecode:: pycon+sql >>> from sqlalchemy import true >>> print(select(t.c.x).where(true())) {printsql}SELECT x FROM t WHERE true A backend which does not support true/false constants will render as an
()
| 1693 | |
| 1694 | |
| 1695 | def true() -> True_: |
| 1696 | """Return a constant :class:`.True_` construct. |
| 1697 | |
| 1698 | E.g.: |
| 1699 | |
| 1700 | .. sourcecode:: pycon+sql |
| 1701 | |
| 1702 | >>> from sqlalchemy import true |
| 1703 | >>> print(select(t.c.x).where(true())) |
| 1704 | {printsql}SELECT x FROM t WHERE true |
| 1705 | |
| 1706 | A backend which does not support true/false constants will render as |
| 1707 | an expression against 1 or 0: |
| 1708 | |
| 1709 | .. sourcecode:: pycon+sql |
| 1710 | |
| 1711 | >>> print(select(t.c.x).where(true())) |
| 1712 | {printsql}SELECT x FROM t WHERE 1 = 1 |
| 1713 | |
| 1714 | The :func:`.true` and :func:`.false` constants also feature |
| 1715 | "short circuit" operation within an :func:`.and_` or :func:`.or_` |
| 1716 | conjunction: |
| 1717 | |
| 1718 | .. sourcecode:: pycon+sql |
| 1719 | |
| 1720 | >>> print(select(t.c.x).where(or_(t.c.x > 5, true()))) |
| 1721 | {printsql}SELECT x FROM t WHERE true{stop} |
| 1722 | |
| 1723 | >>> print(select(t.c.x).where(and_(t.c.x > 5, false()))) |
| 1724 | {printsql}SELECT x FROM t WHERE false{stop} |
| 1725 | |
| 1726 | .. seealso:: |
| 1727 | |
| 1728 | :func:`.false` |
| 1729 | |
| 1730 | """ |
| 1731 | |
| 1732 | return True_._instance() |
| 1733 | |
| 1734 | |
| 1735 | def tuple_( |