Michael Bayer ha scritto:
> On Jun 11, 2007, at 11:19 AM, Glauco wrote:
>
>
>> I use hardly the column prefix, so my query are always aliased.....
>> this obviously cause a lot of problem whith the order_by clause
>> (that NOT use the same aliases)
>>
>>
>
> the approach here depends on how this query is being constructed. if
> you are using your own alias objects, insert the columns as
> referenced from the alias object itself into the order_by clause.
>
> alias = mytable.alias('foo')
> alias.select(order_by=[alias.c.bar])
>
>
>
my problem is exactly this... i don't use aliases, and the example is a
qru constructed by SA.
*Operatore.select_by().order_by( Anagrafica.c.nome).list()*
SQLError: (ProgrammingError) invalid reference to FROM-clause entry for
table "anagrafica"
HINT: Perhaps you meant to reference the table alias "anon_f3fb".
'SELECT operatore.data_inizio_attivita AS
operatore_data_inizio_attivita, operatore.password AS
operatore_password, operatore.logname AS operatore_logname,
operatore.id_anagrafica AS operatore_id_anagrafica,
anon_4877.ts_ultima_modifica AS anon_4877_ts_ultima_modifica,
anon_4877.id AS anon_4877_id, anon_4877.id_anagrafica AS
anon_4877_id_anagrafica, anon_4877.id_operatore AS
anon_4877_id_operatore, anon_4877.data_inizio AS anon_4877_data_inizio,
anon_4877.bdn_data_ultima_modifica AS
anon_4877_bdn_data_ultima_modifica, anon_4877.bdn_id AS
anon_4877_bdn_id, anon_4877.codice_struttura AS
anon_4877_codice_struttura, anon_4877.id_azienda AS
anon_4877_id_azienda, anon_4877.stato_record AS anon_4877_stato_record,
anon_4877.bdn_specie AS anon_4877_bdn_specie, anon_4877.id_precedente AS
anon_4877_id_precedente, anon_4877.bdn_flag_carne_latte AS
anon_4877_bdn_flag_carne_latte, anon_4877.data_fine AS
anon_4877_data_fine, operatore.id AS operatore_id, anon_a2d6.codice AS
anon_a2d6_codice, anon_a2d6.descrizione AS anon_a2d6_descrizione,
anon_a2d6.group_id AS anon_a2d6_group_id, operatore.data_fine_attivita
AS operatore_data_fine_attivita, operatore.zoperoles AS
operatore_zoperoles, anon_f3fb.cod_nazionalita AS
anon_f3fb_cod_nazionalita, anon_f3fb.id AS anon_f3fb_id,
anon_f3fb.id_comune AS anon_f3fb_id_comune, anon_f3fb.cod_professione AS
anon_f3fb_cod_professione, anon_f3fb.dato_fiscale AS
anon_f3fb_dato_fiscale, anon_f3fb.localita AS anon_f3fb_localita,
anon_f3fb.telefono AS anon_f3fb_telefono, anon_f3fb.email AS
anon_f3fb_email, anon_f3fb.nome AS anon_f3fb_nome, anon_f3fb.tipo AS
anon_f3fb_tipo, anon_f3fb.cod_titolo_studio AS
anon_f3fb_cod_titolo_studio, anon_f3fb.indirizzo AS anon_f3fb_indirizzo,
anon_f3fb.id_precedente AS anon_f3fb_id_precedente,
anon_f3fb.cod_nazione_nascita AS anon_f3fb_cod_nazione_nascita,
anon_f3fb.id_comune_nascita AS anon_f3fb_id_comune_nascita,
anon_f3fb.stato_record AS anon_f3fb_stato_record, anon_f3fb.id_operatore
AS anon_f3fb_id_operatore, anon_f3fb.cap AS anon_f3fb_cap,
anon_f3fb.ts_ultima_modifica AS anon_f3fb_ts_ultima_modifica,
anon_f3fb.data_nascita AS anon_f3fb_data_nascita \nFROM operatore LEFT
OUTER JOIN azienda_veterinario AS anon_28bf ON anon_28bf.id_veterinario
= operatore.id LEFT OUTER JOIN unita_aziendale AS anon_4877 ON
anon_4877.id = anon_28bf.id_unita_aziendale LEFT OUTER JOIN acl AS
anon_e91a ON operatore.id = anon_e91a.id_operatore LEFT OUTER JOIN ruolo
AS anon_a2d6 ON anon_a2d6.codice = anon_e91a.cod_ruolo LEFT OUTER JOIN
anagrafica AS anon_f3fb ON anon_f3fb.id = operatore.id_anagrafica ORDER
BY anagrafica.nome, anon_28bf.id, anon_e91a.id, anon_f3fb.id' {}
some ideas?
Glauco
--
+------------------------------------------------------------+
Glauco Uri - Programmatore
glauco(at)allevatori.com
Sfera Carta Software(r) [EMAIL PROTECTED]
Via Bazzanese,69 Casalecchio di Reno(BO) - Tel. 051591054
+------------------------------------------------------------+
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---