Re: [SQLObject] How do I do a LEFT JOIN
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Mark M. <ma...@di...> - 2003-07-07 22:00:05
|
On 07 Jul 2003 15:59:57 -0500, Ian Bicking <ia...@co...> wrote: > On Mon, 2003-07-07 at 15:27, Mark Melvin wrote: >> Hi all, >> >> I am super-excited about this package, but I can't seem to figure out >> how do execute a simple LEFT JOIN SQL query. Am I missing somehting >> basic here? I have my two tables set up, but I can't issue the SQL >> directly with the .select() method because it throws that pesky WHERE in >> at the end. Here is what I am getting: > > I'm glad you are excited about it. You can't really do a left join, but > you can get the same thing iteratively, like: > > for customer in Customer.select(): > contacts = customer.Contacts Thanks for the reply. This seems to connect and do a single SQL query for each item in customer.Contacts. I assume this will be incredibly slow for large record sets? Hmmm...seeing as most of my data is going to be fetched this way (the out of the ordinary case being a customer with no Contacts) this may not be doable for me. Darn. I spent all day looking at implementing this...it is so much cleaner than coding SQL queries into my GUI. -- Mark. |