diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-23 17:41:55 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-23 17:44:52 -0400 |
commit | f035b6e0a41238d092ea2ddd10fdd5de298ff789 (patch) | |
tree | 76c2c9b9e4b63964847126aba054de19cfc485f7 /lib/sqlalchemy/sql/expression.py | |
parent | 382cd56772efd92a9fe5ce46623029a04163c8cf (diff) | |
download | sqlalchemy-f035b6e0a41238d092ea2ddd10fdd5de298ff789.tar.gz |
An overhaul of expression handling for special symbols particularly
with conjunctions, e.g.
``None`` :func:`.expression.null` :func:`.expression.true`
:func:`.expression.false`, including consistency in rendering NULL
in conjunctions, "short-circuiting" of :func:`.and_` and :func:`.or_`
expressions which contain boolean constants, and rendering of
boolean constants and expressions as compared to "1" or "0" for backends
that don't feature ``true``/``false`` constants. [ticket:2804]
Diffstat (limited to 'lib/sqlalchemy/sql/expression.py')
-rw-r--r-- | lib/sqlalchemy/sql/expression.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 01091bc0a..6be32f454 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -33,7 +33,7 @@ from .elements import ClauseElement, ColumnElement,\ BindParameter, UnaryExpression, BooleanClauseList, \ Label, Cast, Case, ColumnClause, TextClause, Over, Null, \ True_, False_, BinaryExpression, Tuple, TypeClause, Extract, \ - Grouping, and_, or_, not_, \ + Grouping, not_, \ collate, literal_column, between,\ literal, outparam, type_coerce, ClauseList @@ -56,6 +56,8 @@ from .dml import Insert, Update, Delete, UpdateBase, ValuesBase # the functions to be available in the sqlalchemy.sql.* namespace and # to be auto-cross-documenting from the function to the class itself. +and_ = public_factory(BooleanClauseList.and_, ".expression.and_") +or_ = public_factory(BooleanClauseList.or_, ".expression.or_") bindparam = public_factory(BindParameter, ".expression.bindparam") select = public_factory(Select, ".expression.select") text = public_factory(TextClause, ".expression.tet") @@ -79,9 +81,9 @@ nullslast = public_factory(UnaryExpression._create_nullslast, ".expression.nulls asc = public_factory(UnaryExpression._create_asc, ".expression.asc") desc = public_factory(UnaryExpression._create_desc, ".expression.desc") distinct = public_factory(UnaryExpression._create_distinct, ".expression.distinct") -true = public_factory(True_, ".expression.true") -false = public_factory(False_, ".expression.false") -null = public_factory(Null, ".expression.null") +true = public_factory(True_._singleton, ".expression.true") +false = public_factory(False_._singleton, ".expression.false") +null = public_factory(Null._singleton, ".expression.null") join = public_factory(Join._create_join, ".expression.join") outerjoin = public_factory(Join._create_outerjoin, ".expression.outerjoin") insert = public_factory(Insert, ".expression.insert") @@ -89,7 +91,6 @@ update = public_factory(Update, ".expression.update") delete = public_factory(Delete, ".expression.delete") - # internal functions still being called from tests and the ORM, # these might be better off in some other namespace from .base import _from_objects |