On Jan 14, 2008, at 12:12 PM, Alexandre Conrad wrote:
> Mike,
>
> Michael Bayer wrote:
>> a certain id_channel. otherwise im still having trouble wrapping my
>> head around what youre trying to do there.
>
> Enough guessing, here's the full test case with description of what
> I'm
> trying to do. :)
>
> Although, I wasn't able to make it run with sqlite, so it's running a
> under a "foo" table with MySQL. (another hidden bug, I'm getting
> (IntegrityError) medias.id may not be NULL).
>
ok, you can also do it like this:
select_table =
catalog_table.outerjoin(catalog_channel_table).select().alias('pjoin')
catalog_mapper = mapper(Catalog, catalog_table,
select_table=select_table, polymorphic_on=catalog_table.c.type,
polymorphic_identity="catalog",
properties={
"medias":relation(Media,
backref="catalog",
cascade="all, delete-orphan",
),
},
)
print
Media
.query
.join
('catalog').filter(CatalogChannel.id_channel==playlist.id_channel).all()
Still working on getting "select_table" to not have to be aliased like
that.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---