[sqlalchemy] Re: how to rename labels?
On 12/28/06, jose [EMAIL PROTECTED] wrote: I would like to know how assign label names as in: comune.cod_provincia AS sigla_provincia instead of: comune.cod_provincia AS comune_cod_provincia http://www.sqlalchemy.org/docs/sqlconstruction.myt#sql_select_labels -- Lee McFadden blog: http://www.splee.co.uk work: http://fireflisystems.com skype: fireflisystems --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: how to rename labels?
Lee McFadden wrote: On 12/28/06, jose [EMAIL PROTECTED] wrote: I would like to know how assign label names as in: comune.cod_provincia AS sigla_provincia instead of: comune.cod_provincia AS comune_cod_provincia http://www.sqlalchemy.org/docs/sqlconstruction.myt#sql_select_labels I Lee, I see this examples works only with table object. Is there a way to use it with class mappers? jo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: how to rename labels?
On 12/28/06, jose [EMAIL PROTECTED] wrote: I Lee, I see this examples works only with table object. Is there a way to use it with class mappers? If you're using the class mappers I'm not quite sure why you'd need to fiddle with the labels - you shouldn't even need to see the generated SQL outside of the logging of the SQL statements. Is there some error you're coming across due to the automatically generated labels? Lee -- Lee McFadden blog: http://www.splee.co.uk work: http://fireflisystems.com skype: fireflisystems --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: how to rename labels?
Lee McFadden wrote: On 12/28/06, jose [EMAIL PROTECTED] wrote: I Lee, I see this examples works only with table object. Is there a way to use it with class mappers? If you're using the class mappers I'm not quite sure why you'd need to fiddle with the labels - you shouldn't even need to see the generated SQL outside of the logging of the SQL statements. Is there some error you're coming across due to the automatically generated labels? Lee I think I'm yet a little bit confused about using table objects or class mappers... I think I'm doing a fruit salade with both of them: Here I'm using classes (Anagrafica and Azienda) and also table objects (tbl['table_name']) because I need label()... this is a readonly query, should I use only table objects, in this context? / sql=select( [Anagrafica.c.id, tbl['azienda'].c.id.label('pk'), Anagrafica.c.nome, Anagrafica.c.indirizzo, tbl['comune'].c.nome.label('nome_comune'), Azienda.c.codice_aziendale], limit=limit, offset=offset,order_by=[sort], use_labels=True) / jo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: how to rename labels?
On 12/28/06, jose [EMAIL PROTECTED] wrote: I think I'm yet a little bit confused about using table objects or class mappers... I think I'm doing a fruit salade with both of them: Here I'm using classes (Anagrafica and Azienda) and also table objects (tbl['table_name']) because I need label()... this is a readonly query, should I use only table objects, in this context? Yes, for what you want to do it would probably be better to only use table objects. It makes more sense (imho) as you're not going to be getting an object(s) back, you're going to get rows of data. This way you'll be able to use the labels properly as per the documentation. Lee -- Lee McFadden blog: http://www.splee.co.uk work: http://fireflisystems.com skype: fireflisystems --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---