On Sep 20, 2010, at 11:54 AM, Michael Hipp wrote:

> On 9/20/2010 10:09 AM, Michael Hipp wrote:
>> On 9/20/2010 9:38 AM, Michael Hipp wrote:
>>> Scratch that ... found this message:
>>> http://www.mail-archive.com/[email protected]/msg18598.html
>>> which says I should be able to do a 'SIMILAR TO' construct which is perhaps
>>> somewhat more lightweight than a full regexp.
>> 
>> Can someone show me what I'm doing wrong here.
>> 
>> letter = 'A[0-9]+'
>> q = self.session.query(Car).filter_by(hist=False) \
>> .filter(Car.lane.op('SIMILAR TO') (letter)) \
>> .order_by(Car.lane)
>> 
>> I'm trying to match something that looks like 'A100'. But it produces a 
>> syntax
>> error:
>> 
>> OperationalError: (OperationalError) near "SIMILAR": syntax error
>> ...snip...
>> WHERE cars.hist = ? AND (cars.lane SIMILAR TO ?) ORDER BY cars.lane' (False,
>> 'A[0-9]+')
> 
> Strange. I couldn't see what was actually wrong with that SQL, so I ran it 
> directly against pg and it works fine. Is it possibly a quoting problem?

is this pg8000 ?  the "?" as binds are suspect.  that would be my guess.


> 
> Michael
> 
> -- 
> 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.
> 

-- 
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.

Reply via email to