diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-16 12:36:13 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-16 12:36:13 -0400 |
commit | a180239d8eda8c20ea39f4f5190abf51deba8b05 (patch) | |
tree | 864da3ec361f13f2fbce02735a2c8c6c54b7f16a /lib/sqlalchemy/sql/operators.py | |
parent | 0e29e6e7abea6ae7235de302c966ab9fb343819c (diff) | |
download | sqlalchemy-a180239d8eda8c20ea39f4f5190abf51deba8b05.tar.gz |
docs for custom ops...
Diffstat (limited to 'lib/sqlalchemy/sql/operators.py')
-rw-r--r-- | lib/sqlalchemy/sql/operators.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py index 560f723f2..ba1117ef6 100644 --- a/lib/sqlalchemy/sql/operators.py +++ b/lib/sqlalchemy/sql/operators.py @@ -170,6 +170,23 @@ class Operators(object): class custom_op(object): + """Represent a 'custom' operator. + + :class:`.custom_op` is normally instantitated when the + :meth:`.ColumnOperators.op` method is used to create a + custom operator callable. The class can also be used directly + when programmatically constructing expressions. E.g. + to represent the "factorial" operation:: + + from sqlalchemy.sql import UnaryExpression + from sqlalchemy.sql import operators + from sqlalchemy import Numeric + + unary = UnaryExpression(table.c.somecolumn, + modifier=operators.custom_op("!"), + type_=Numeric) + + """ __name__ = 'custom_op' def __init__(self, opstring, precedence=0): |