Hi all,

I can't realize how to create a sql custom function. I need to transform a string column value into a number as in:

def mese(par):
       mm = dict(A=1,B=2,C=3,D=4,E=5,H=6,L=7,M=8,P=9,R=10,S=11,T=12)
       return mm[par.upper()]


I tried to use it in a query as this one below, but it doesn't work:

session.query(Ana).filter(Ana.c.mese==mese(sa.func.substr(Ana.c.cfiscale,8,9))

Please, could someone help me to write a such function?
thanks

j


--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to