On Fri, Jun 28, 2013 at 11:05 AM, Burak Arslan
<burak.ars...@arskom.com.tr> wrote:
> On 06/28/13 11:55, Simon King wrote:
>> When you write this:
>>>>> e.execute(t.select(t.c.a.like('\\')))
>> ...the pattern that you are sending to SA is a single backslash, and
>> SA is forwarding that directly to PG. What do you think the behaviour
>> should be in this case?
>>
>
> Well, I'd prefer sqlalchemy did not leak such quirks and escape strings
> sent to .like() accordingly.
>
> In other words, I want the two to be equivalent:
>
>>>> e.execute(t.select(t.c.a.like('\\')))
>>>> e.execute(t.select(t.c.a == '\\'))
>
> Otherwise, I'll have to implement a psql_escape_for_like function and
> make it run like so:
>
>>>> e.execute(t.select(t.c.a.like(psql_escape_for_like(whatever))))
>
> I wouldn't really prefer to go down this route -- it's ugly!..

Ah, OK, I see what you mean now. I'm not sure this could be changed
without breaking backwards compatibility. I wonder if you could do
something with the compiler module
(http://docs.sqlalchemy.org/en/rel_0_8/core/compiler.html).

Simon

-- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to