On Jan 14, 2008, at 12:44 PM, Alexandre Conrad wrote:

>
> Michael Bayer wrote:
>> your best bet with this mapping right now is:
>>
>> print
>> Media
>> .query
>> .select_from
>> (media_table
>> .join
>> (catalog_table
>> ).join
>> (catalog_channel_table
>> )).filter(CatalogChannel.c.id_channel==playlist.id_channel).all()
>>
>> which is really how select_from() was intended to be used.
>
> This works with SQLite, but not MySQL: (1054, "Unknown column
> 'catalog_channels.id_channel' in 'on clause'")
>

that doesnt sound right.  taking out select_table, and doing:

print  
Media 
.query 
.select_from 
(media_table 
.join 
(catalog_table 
).join 
(catalog_channel_table 
)).filter(CatalogChannel.c.id_channel==playlist.id_channel).all()

leads to the SQL:

SELECT medias.id AS medias_id, medias.name AS medias_name,  
medias.id_catalog AS medias_id_catalog
FROM medias JOIN catalogs ON catalogs.id = medias.id_catalog JOIN  
catalog_channels ON catalogs.id = catalog_channels.id
WHERE catalog_channels.id_channel = ? ORDER BY medias.oid

which is entirely acceptable (and works in mysql).



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

Reply via email to