oh, you could send that as a tuple to join, i.e. db.devmap_device.join((db.devmap_manufacturer, db.devmap_device.manufacturer_id == db.devmap_manufacturer.id)).first()
this because join() accepts a list of "join conditions", a composite condition is sent as a tuple. On Mar 31, 2009, at 11:12 AM, Jonathan Ellis wrote: > > You can't just throw filter expressions into the join call in modern > sqla. Try > > db > .devmap_device > .join(db.devmap_manufacturer).filter(db.devmap_device.manufacturer_id > == db.devmap_manufacturer.id).first() > > -Jonathan > > On Tue, Mar 31, 2009 at 8:23 AM, Stu.Axon <stu.a...@gmail.com> wrote: >> >> Heres some input that used to work, and the error that now happens >> >>>>> from sqlalchemy.ext.sqlsoup import SqlSoup, MetaData >>>>> >>>>> db_uri = 'postgres://user:passw...@127.0.0.1/games' >>>>> db = SqlSoup(db_uri) >>>>> db.devmap_device.join(db.devmap_manufacturer, >>>>> db.devmap_device.manufacturer_id == >>>>> db.devmap_manufacturer.id).first() >> Traceback (most recent call last): >> File "<console>", line 1, in <module> >> File "<string>", line 1, in <lambda> >> File "c:\python25\lib\site-packages\sqlalchemy-0.5.3-py2.5.egg >> \sqlalchemy\util.py", line 212, in go >> return fn(*args, **kw) >> File "c:\python25\lib\site-packages\sqlalchemy-0.5.3-py2.5.egg >> \sqlalchemy\orm\query.py", line 870, in join >> return self.__join(props, outerjoin=False, create_aliases=aliased, >> from_joinpoint=from_joinpoint) >> File "<string>", line 1, in <lambda> >> File "c:\python25\lib\site-packages\sqlalchemy-0.5.3-py2.5.egg >> \sqlalchemy\orm\query.py", line 52, in generate >> fn(self, *args[1:], **kw) >> File "c:\python25\lib\site-packages\sqlalchemy-0.5.3-py2.5.egg >> \sqlalchemy\orm\query.py", line 1069, in __join >> clause = orm_join(clause, right_entity, onclause, >> isouter=outerjoin, join_to_left=join_to_left) >> File "c:\python25\lib\site-packages\sqlalchemy-0.5.3-py2.5.egg >> \sqlalchemy\orm\util.py", line 439, in join >> return _ORMJoin(left, right, onclause, isouter, join_to_left) >> File "c:\python25\lib\site-packages\sqlalchemy-0.5.3-py2.5.egg >> \sqlalchemy\orm\util.py", line 416, in __init__ >> expression.Join.__init__(self, left, right, onclause, isouter) >> File "c:\python25\lib\site-packages\sqlalchemy-0.5.3-py2.5.egg >> \sqlalchemy\sql\expression.py", line 2482, in __init__ >> self.onclause = self._match_primaries(self.left, self.right) >> File "c:\python25\lib\site-packages\sqlalchemy-0.5.3-py2.5.egg >> \sqlalchemy\sql\expression.py", line 2528, in _match_primaries >> return sql_util.join_condition(primary, secondary) >> File "c:\python25\lib\site-packages\sqlalchemy-0.5.3-py2.5.egg >> \sqlalchemy\sql\util.py", line 114, in join_condition >> col = fk.get_referent(b) >> File "c:\python25\lib\site-packages\sqlalchemy-0.5.3-py2.5.egg >> \sqlalchemy\schema.py", line 860, in get_referent >> return table.corresponding_column(self.column) >> File "c:\python25\lib\site-packages\sqlalchemy-0.5.3-py2.5.egg >> \sqlalchemy\sql\expression.py", line 2683, in __getattr__ >> return getattr(self.element, attr) >> AttributeError: '_BinaryExpression' object has no attribute >> 'corresponding_column' >>>>> >> >>> >> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---