Hi all, i'm using the funct.cast in postgreSQL, but i thing the correct 
dialect is not used


This is an example:
valore is a text field.



Scheda.select( tbl['scheda'].c.valore == '753' )

SELECT scheda.id_precedente AS scheda_id_precedente, scheda.stato_record 
AS scheda_stato_record, scheda.ts_ultima_modifica AS 
scheda_ts_ultima_modifica, scheda.cod_unita_di_misura AS 
scheda_cod_unita_di_misura, scheda.id_figura_aziendale AS 
scheda_id_figura_aziendale, scheda.id AS scheda_id, scheda.id_azienda AS 
scheda_id_azienda, scheda.partite AS scheda_partite, 
scheda.cod_caratteristica_rischio AS scheda_cod_caratteristica_rischio, 
scheda.cod_attivita AS scheda_cod_attivita, scheda.id_produzione AS 
scheda_id_produzione, scheda.data_rilevamento AS 
scheda_data_rilevamento, scheda.id_unita_aziendale AS 
scheda_id_unita_aziendale, scheda.id_operatore AS scheda_id_operatore, 
scheda.valore AS scheda_valore
FROM scheda
WHERE scheda.valore = %(scheda_valore)s ORDER BY scheda.id
{'scheda_valore': '753'}


Scheda.select( func.cast( tbl['scheda'].c.valore, 'int')  == '753' )

SQLError: (ProgrammingError) syntax error at or near "," at character 751
 'SELECT scheda.id_precedente AS scheda_id_precedente, 
scheda.stato_record AS scheda_stato_record, scheda.ts_ultima_modifica AS 
scheda_ts_ultima_modifica, scheda.cod_unita_di_misura AS 
scheda_cod_unita_di_misura, scheda.id_figura_aziendale AS 
scheda_id_figura_aziendale, scheda.id AS scheda_id, scheda.id_azienda AS 
scheda_id_azienda, scheda.partite AS scheda_partite, 
scheda.cod_caratteristica_rischio AS scheda_cod_caratteristica_rischio, 
scheda.cod_attivita AS scheda_cod_attivita, scheda.id_produzione AS 
scheda_id_produzione, scheda.data_rilevamento AS 
scheda_data_rilevamento, scheda.id_unita_aziendale AS 
scheda_id_unita_aziendale, scheda.id_operatore AS scheda_id_operatore, 
scheda.valore AS scheda_valore \nFROM scheda \nWHERE 
*cast(scheda.valore, %(cast)s)* = %(cast_1)s ORDER BY scheda.id' 
{'cast': 'int', 'cast_1': '753'}



casting in Postgres  use another syntax:
*cast(sche3086.valore as int)*

is this a bug or i'm missing to tell dialect?




Glauco

-- 



+------------------------------------------------------------+
 Glauco Uri  
 glauco(at)sferacarta.com 
                               
          Sfera Carta Software®       info(at)sferacarta.com
  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 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