diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-08-18 21:37:48 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-08-18 21:37:48 +0000 |
commit | 7c6c1b99c2de00829b6f34ffba7e3bb689d34198 (patch) | |
tree | acd6f8dc84cea86fc58b195a5f1068cbe020e955 /lib/sqlalchemy/sql/operators.py | |
parent | 534cf5fdbd05e2049ab9feceabf3926a5ab6380c (diff) | |
download | sqlalchemy-7c6c1b99c2de00829b6f34ffba7e3bb689d34198.tar.gz |
1. Module layout. sql.py and related move into a package called "sql".
2. compiler names changed to be less verbose, unused classes removed.
3. Methods on Dialect which return compilers, schema generators, identifier preparers
have changed to direct class references, typically on the Dialect class itself
or optionally as attributes on an individual Dialect instance if conditional behavior is needed.
This takes away the need for Dialect subclasses to know how to instantiate these
objects, and also reduces method overhead by one call for each one.
4. as a result of 3., some internal signatures have changed for things like compiler() (now statement_compiler()), preparer(), etc., mostly in that the dialect needs to be passed explicitly as the first argument (since they are just class references now). The compiler() method on Engine and Connection is now also named statement_compiler(), but as before does not take the dialect as an argument.
5. changed _process_row function on RowProxy to be a class reference, cuts out 50K method calls from insertspeed.py
Diffstat (limited to 'lib/sqlalchemy/sql/operators.py')
-rw-r--r-- | lib/sqlalchemy/sql/operators.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py new file mode 100644 index 000000000..b8aca3d26 --- /dev/null +++ b/lib/sqlalchemy/sql/operators.py @@ -0,0 +1,61 @@ +"""define opeators used in SQL expressions""" + +from operator import and_, or_, inv, add, mul, sub, div, mod, truediv, lt, le, ne, gt, ge, eq + +def from_(): + raise NotImplementedError() + +def as_(): + raise NotImplementedError() + +def exists(): + raise NotImplementedError() + +def is_(): + raise NotImplementedError() + +def isnot(): + raise NotImplementedError() + +def like_op(a, b): + return a.like(b) + +def notlike_op(a, b): + raise NotImplementedError() + +def ilike_op(a, b): + return a.ilike(b) + +def notilike_op(a, b): + raise NotImplementedError() + +def between_op(a, b): + return a.between(b) + +def in_op(a, b): + return a.in_(*b) + +def notin_op(a, b): + raise NotImplementedError() + +def distinct_op(a): + return a.distinct() + +def startswith_op(a, b): + return a.startswith(b) + +def endswith_op(a, b): + return a.endswith(b) + +def comma_op(a, b): + raise NotImplementedError() + +def concat_op(a, b): + return a.concat(b) + +def desc_op(a): + return a.desc() + +def asc_op(a): + return a.asc() + |