]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Restored NotImplementedError on Cls.relation.in_()
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 10 Nov 2008 16:18:57 +0000 (16:18 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 10 Nov 2008 16:18:57 +0000 (16:18 +0000)
[ticket:1140] [ticket:1221]

CHANGES
lib/sqlalchemy/orm/properties.py
test/orm/query.py

diff --git a/CHANGES b/CHANGES
index d71fd226eae94336dcbd670826a4331902387608..373a56559f46536f33409e1b90208d8159da81e3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -30,6 +30,9 @@ CHANGES
       error message when executed against multiple entities.
       [ticket:1220]
 
+    - Restored NotImplementedError on Cls.relation.in_()
+      [ticket:1140] [ticket:1221]
+      
 - sql
     - Removed the 'properties' attribute of the 
       Connection object, Connection.info should be used.
index 2fc72e8130f8df61bdb594ab7e60204bec059aad..dbc3430a06d570be1d90476ce3471998ae0910e6 100644 (file)
@@ -359,6 +359,10 @@ class PropertyLoader(StrategizedProperty):
         def of_type(self, cls):
             return PropertyLoader.Comparator(self.prop, self.mapper, cls)
 
+        def in_(self, other):
+            raise NotImplementedError("in_() not yet supported for relations.  For a "
+                    "simple many-to-one, use in_() against the set of foreign key values.")
+            
         def __eq__(self, other):
             if other is None:
                 if self.prop.direction in [ONETOMANY, MANYTOMANY]:
index 3e2f327c35cb0248569728b8728abaacd2773942..72cb1d4aeb905d76c5e6c5baecc7e38ff324fd9b 100644 (file)
@@ -434,6 +434,9 @@ class OperatorTest(QueryTest, AssertsCompiledSQL):
          self._test(User.id.in_(['a', 'b']),
                     "users.id IN (:id_1, :id_2)")
 
+    def test_in_on_relation_not_supported(self):
+        self.assertRaises(NotImplementedError, Address.user.in_, [User(id=5)])
+        
     def test_between(self):
         self._test(User.id.between('a', 'b'),
                    "users.id BETWEEN :id_1 AND :id_2")