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
()
| 1918 | |
| 1919 | |
| 1920 | def true() -> True_: |
| 1921 | """Return a constant :class:`.True_` construct. |
| 1922 | |
| 1923 | E.g.: |
| 1924 | |
| 1925 | .. sourcecode:: pycon+sql |
| 1926 | |
| 1927 | >>> from sqlalchemy import true |
| 1928 | >>> print(select(t.c.x).where(true())) |
| 1929 | {printsql}SELECT x FROM t WHERE true |
| 1930 | |
| 1931 | A backend which does not support true/false constants will render as |
| 1932 | an expression against 1 or 0: |
| 1933 | |
| 1934 | .. sourcecode:: pycon+sql |
| 1935 | |
| 1936 | >>> print(select(t.c.x).where(true())) |
| 1937 | {printsql}SELECT x FROM t WHERE 1 = 1 |
| 1938 | |
| 1939 | The :func:`.true` and :func:`.false` constants also feature |
| 1940 | "short circuit" operation within an :func:`.and_` or :func:`.or_` |
| 1941 | conjunction: |
| 1942 | |
| 1943 | .. sourcecode:: pycon+sql |
| 1944 | |
| 1945 | >>> print(select(t.c.x).where(or_(t.c.x > 5, true()))) |
| 1946 | {printsql}SELECT x FROM t WHERE true{stop} |
| 1947 | |
| 1948 | >>> print(select(t.c.x).where(and_(t.c.x > 5, false()))) |
| 1949 | {printsql}SELECT x FROM t WHERE false{stop} |
| 1950 | |
| 1951 | .. seealso:: |
| 1952 | |
| 1953 | :func:`.false` |
| 1954 | |
| 1955 | """ |
| 1956 | |
| 1957 | return True_._instance() |
| 1958 | |
| 1959 | |
| 1960 | def tuple_( |