On Jan 14, 2008, at 10:44 AM, Alexandre Conrad wrote:

>
>
>
> Michael Bayer wrote:
>
>> I came up with a very easy way to implement this which I'd like you  
>> to
>> try out in rev 4060.  So far I've tested with a basic joined table
>> inheritance setup.
>>
>> All you do is place class-mapped attributes directly in the join()
>> arguments along with strings.  and thats it !  so it looks like:
>>
>>      session.query(Media).join(['catalog', CatalogChannel.channel])
>>
>> The class-attributes can be freely intermixed with the existing  
>> string-
>> based attributes.
>>
>> Technically you can place any class-attribute you want in there but  
>> it
>> only makes sense if it can be joined against the immediately  
>> preceding
>> attribute or parent mapper.  I'm not sure if that restriction could
>> change eventually.
>
>
> model.Media.query.join(["catalog",
> model 
> .CatalogChannel 
> .channel 
> ]).filter 
> (model.CatalogChannel.c.id_channel==c.playlist.id_channel).all()
>
> generates:
>
> SELECT files.id AS files_id, medias.id AS medias_id, files.name AS
> files_name, files.mime AS files_mime, files.date AS files_date,
> files.size AS files_size, files.checksum AS files_checksum,
> files.description AS files_description, files.type AS files_type,
> medias.id_catalog AS medias_id_catalog
> FROM catalog_channels, files INNER JOIN medias ON files.id = medias.id
> INNER JOIN catalogs ON catalogs.id = medias.id_catalog INNER JOIN
> channels ON channels.id = catalog_channels.id_channel
> WHERE catalog_channels.id_channel = %s ORDER BY files.name
>

whats that filter() trying to accomplish ?  please work this into a  
full test case using SQLite so I can run through it.




--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to