def testjoinbyfk(self):
class UserWithAddress(object):
def __repr__(self):
import locale
encoding = locale.getdefaultlocale()[1]
L = []
for k in self.__class__.c.keys():
value = getattr(self, k, '')
if isinstance(value, unicode):
value = value.encode(encoding)
L.append("%s=%r" % (k, value))
return '%s(%s)' % (self.__class__.__name__, ','.join(L))
j = join(users, addresses, isouter=True)
m = mapper(UserWithAddress, j)
q = create_session().query(m)
import sys
sys.stderr.write('%s\n' % list(q.select()))
self.assert_(len(list(q.select())) == 5)
Only four rows come back... the user with no corresponding addresses (#9) doesn't appear even though an outer join was specified.
--
Jonathan Ellis
http://spyced.blogspot.com
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users