we would need to know what database you're using.   It's likely your DB doesn't 
support REGEXP_LIKE.


On Apr 18, 2012, at 4:00 AM, jo wrote:

> Hi all,
> 
> Someone could help me with this query?
> 
> SELECT MAX(CAST(SUBSTR(codice_aziendale, 2) AS INTEGER)) FROM azienda WHERE 
> codice_aziendale LIKE '#%%' AND REGEXP_LIKE(SUBSTR(codice_aziendale, 2) , 
> '[[:digit:]]')
> 
> 
> I'm trying in this way:
> 
> session.query(sa.func.max(sa.func.cast(sa.func.substr(Azienda.c.codice_aziendale,2),
>  sa.Integer))).filter(sa.func.REGEXP_LIKE(Azienda.c.data_inizio, 
> '[[:digit:]]')).scalar()
> 
> but I got this error:
> 
> NotSupportedError: (NotSupportedError) Variable_TypeByValue(): unhandled data 
> type Integer 'SELECT max(cast(substr(azienda.codice_aziendale, :substr_1), 
> :cast_1)) AS max_1 \nFROM azienda \nWHERE REGEXP_LIKE(azienda.data_inizio, 
> :REGEXP_LIKE_1)' {'REGEXP_LIKE_1': '[[:digit:]]', 'substr_1': 2, 'cast_1': 
> Integer()}
> 
> 
> j
> 
> -- 
> 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 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to