Kirk Strauser wrote:
>
> On Friday 31 July 2009 08:30:52 am Kirk Strauser wrote:
>> On Thursday 30 July 2009 04:26:20 pm Michael Bayer wrote:
>> > you have to get the select() syntax right:
>> >
>> >
>> > BillingInfo = relation('BillingInfo',
>> >
>> > primaryjoin="and_(Invoice.pay2addrid==BillingInfo.pay2addrid,Invoice.cust
>> >om er==
>> > select([Customer.customer]).where(Customer.xrscustid==BillingInfo.xrscust
>> >id ))")
>>
>> Michael, a million thanks. Seriously. That did exactly what I needed,
>> and
>> should handle a bunch of similar issues with other legacy tables. I
>> appreciate it!
>
> Can you stand one more question on this? I tried to enable eager loading
> on this table:
>
> invoices = invoices.options(eagerload('BillingInfo'))
>
> but ended up with an error:
>
> sqlalchemy.exc.InvalidRequestError: Select statement 'SELECT
> fro.xrscust.xrscust
> FROM fro.xrscust, fro.bllginfo AS bllginfo_1
> WHERE bllginfo_1.xrscustid = fro.xrscust.xrscustid' returned no FROM
> clauses due to auto-correlation; specify
> correlate(<tables>) to control correlation manually.
>
> I don't really understand what it's asking for, and the docs for
> correlate()
> only seem to explain how to configure it and not what I should want it
> to be set to.
you likely want to call correlate(billing_table) on your select. rows
inside the subquery want to correlate outwards to the parent billing
table.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---