Mike Bayer  committed 2e4a2ea

- added op() operator to instrumented attributes; i.e.'ilike')('%somename%') [ticket:767]

  • Participants
  • Parent commits 26aff0d

Comments (0)

Files changed (4)

     "attribute_names", a list of individual attribute keynames to be refreshed
     or expired, allowing partial reloads of attributes on an already-loaded 
     instance. [ticket:802]
+  - added op() operator to instrumented attributes; i.e. 
+'ilike')('%somename%') [ticket:767]
   - Mapped classes may now define __eq__, __hash__, and __nonzero__ methods
     with arbitrary semantics.  The orm now handles all mapped instances on

File lib/sqlalchemy/sql/

     def __invert__(self):
         return self.operate(operators.inv)
+    def op(self, opstring):
+        def op(b):
+            return self.operate(operators.op, opstring, b)
+        return op
     def clause_element(self):
         raise NotImplementedError()

File lib/sqlalchemy/sql/

 def isnot():
     raise NotImplementedError()
+def op(a, opstring, b):
+    return a.op(opstring)(b)
 def like_op(a, b):

File test/orm/

                              "\n'" + compiled + "'\n does not match\n'" +
                              fwd_sql + "'\n or\n'" + rev_sql + "'")
+    def test_op(self):
+        assert str('ilike')('17').compile(dialect=default.DefaultDialect())) == " ilike :users_name"
     def test_in(self):
          self._test(['a', 'b']),
                     " IN (:users_id, :users_id_1)")