0

I saw the true expression in the docs, and I'm curious what its point is.

Example from the docs:

from sqlalchemy import true
print(select(t.c.x).where(true()))

The above results in SELECT x FROM t WHERE true, which is the same as SELECT x FROM t (?).

What are the reasons to construct a query like that?

kaveh
  • 2,046
  • 1
  • 21
  • 33
  • 2
    So you can write a query that takes a conditional, but have the default be all records, without having to use a separate version of the query without `where` – kindall Feb 22 '23 at 15:00

0 Answers0