- Comparison of many-to-one relation to NULL is
properly converted to IS NOT NULL based on not_().
-
+
+ - Extra checks added to ensure explicit
+ primaryjoin/secondaryjoin are ClauseElement
+ instances, to prevent more confusing errors later
+ on.
+
- sql
- Fixed the import weirdness in sqlalchemy.sql
to not export __names__ [ticket:1215].
for attr in ('primaryjoin', 'secondaryjoin'):
val = getattr(self, attr)
if val:
+ util.assert_arg_type(val, sql.ClauseElement, attr)
setattr(self, attr, _orm_deannotate(val))
if self.order_by:
class JoinConditionErrorTest(testing.TestBase):
+
+ def test_clauseelement_pj(self):
+ from sqlalchemy.ext.declarative import declarative_base
+ Base = declarative_base()
+ class C1(Base):
+ __tablename__ = 'c1'
+ id = Column('id', Integer, primary_key=True)
+ class C2(Base):
+ __tablename__ = 'c2'
+ id = Column('id', Integer, primary_key=True)
+ c1id = Column('c1id', Integer, ForeignKey('c1.id'))
+ c2 = relation(C1, primaryjoin=C1.id)
+
+ self.assertRaises(sa.exc.ArgumentError, compile_mappers)
+
+
def test_fk_error_raised(self):
m = MetaData()
t1 = Table('t1', m,