(wow, way to go tab key! Sorry, folks)

I'm having a bit of trouble and I think it may be a deficiency in my
understanding of SqlAlchemy.

Let's say I have:

Table(Apples)
Table(Crates)

apples_by_crate = \
    select([ crate_table.c.id.label("crate_id"),
                 apple_table.c.id.label("apple_id"),
             ],
           from_obj = <long list of tables and conditions here>)
apples_by_crate_a = apples_by_crate.correlate(None).alias('_apples_by_crate')


mapper(Crates,
              'apples':relation(Apples, viewonly=True,
secondary=apples_by_crate,
                                        primaryjoin= apple_table.c.id
== apples_by_crate_a.c.apple_id,
                                        secondaryjoin=
apples_by_crate_a.c.crate_id == crate_table.c.id,
                                        foreignkeys= [
apples_by_crate_a.c.apple_id, crate_table.c.id ]))

This works fine...until I try to eagerload apples. Bad Things Happen.
If it's a confounding factor, know that
apples_by_crate contains another subquery that also has a column "crate_id".

My impression right now is that I need to .use_labels for my
subqueries so I don't have conflicting names, but I'm starting to
wonder if I'm just doing it wrong.

Any advice?

Alan

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to