Sorry, both contains_eager and eagerload_all() work, however both
produce the same SQL, where both related tables are joined twice. They
both produce:
SELECT <several columns here>
FROM farm.qstatus
LEFT OUTER JOIN farm.chunk ON farm.chunk.queue_job_id =
farm.qstatus.job_number
LEFT OUTER JOIN farm.pass ON farm.pass.job = farm.chunk.job AND
farm.pass.name = farm.chunk.pass
LEFT OUTER JOIN farm.chunk AS chunk_1 ON chunk_1.queue_job_id =
farm.qstatus.job_number
LEFT OUTER JOIN farm.pass AS pass_1 ON pass_1.job = chunk_1.job AND
pass_1.name = chunk_1.pass
ORDER BY farm.qstatus.job_name, farm.pass.name, farm.qstatus.owner,
chunk_1.job, pass_1.name
Michael Bayer wrote:
>> Tried that still no luck. If it helps any, the job_info table is
>> temporary and doesn't have any keys, or foreign keys, since it is
>> being
>> constantly updated. So I am doing the join in my mapper:
>>
>> qstat_mapper = mapper(JobInfo, qstat_table,
>> primary_key=[qstat_table.c.job_number], properties={
>> 'Chunk':relation(Chunk, lazy=True, uselist=False,
>>
>> primaryjoin=chunk_table.c.queue_job_id==qstat_table.c.job_number,
>> foreign_keys=[chunk_table.c.queue_job_id])})
>>
>>
>
>
> if a plain eager load works here, then the contains_eager() option
> should work as well. if you are joining to an alias of the joined
> table, that needs to be sent to contains_eager() as well.
>
> If a plain eager load does *not* work, then you have to get that going
> first (and for that, you have to ensure that at least a *lazy* load
> works). temp table/no pks/no fks have no impact here since you are
> defining those things on your mapper.
>
> Feel free to produce a standalone script using sqlite illustrating the
> table structure, ORM setup, and ORM query you're trying to do.
>
>
> >
>
>
--
David Gardner
Pipeline Tools Programmer, "Sid the Science Kid"
Jim Henson Creature Shop
(323) 802-1717 [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---