From a180239d8eda8c20ea39f4f5190abf51deba8b05 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 16 Aug 2012 12:36:13 -0400 Subject: docs for custom ops... --- lib/sqlalchemy/sql/operators.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/sqlalchemy/sql/operators.py') 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): -- cgit v1.2.1