Sorry - I meant to post this to the elixir group.
vic
On May 17, 3:56 pm, Victor Ng <[EMAIL PROTECTED]> wrote:
> I'm struggling to join 3 tables together and I can't seem to figure
> out the correct syntax to do this:
>
> I have 3 classes that are laid out like this:
>
> 6 class Bar(Entity):
> 7 has_field('col_a', Integer(), unique=True)
> 8 using_options(tablename='bar')
> 9
> 10 class Blah(Entity):
> 11 has_field('col_a', Integer(), unique=True)
> 12 using_options(tablename='blah')
> 13
> 14 class Foo(Entity):
> 15 belongs_to('bar', of_kind='Bar')
> 16 belongs_to('blah', of_kind='Blah')
> 17 using_options(tablename='foo')
>
> What I want to express is a join between Foo, Bar and Blah, and fetch
> Foo records where Bar and Blah have specified values.
>
> So something like this:
>
> select foo.* from foo, bar, blah where foo.bar_id = bar.id and
> foo.blah_id = blah.id and bar.col_a = 42 and blah.col_a = 55;
>
> Can someone point out the part of the elixir or sqlalchemy ORM
> documentation that I should be looking at?
>
> thanks
> vic
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---