I'm having trouble with a construct like:

SELECT fname FROM names WHERE SUBSTRING(tel, 4, 7) IN ('5551212', '4443333')

The construct:

sql.func.substring(entattr.c.val,4,7).in_(p1, p2)

throws an error.

I've looked into creating a freestanding in_ function in sql.py, which is messy -- looks like one can't prevent someone from using multiple clauses on the left side of the IN (which would be invalid SQL), and into extending the Function() class with an .in_ function, which so far has been inscrutable to me.

Can anyone suggest a different construct, or how to attack that Function() class?

Thx,
Rick

Reply via email to