here's a test, passes for me (even that it uses terrible names for the bound
parameters in this case):
from sqlalchemy import create_engine
from sqlalchemy.sql import literal_column, select
e = create_engine("postgresql://scott:tiger@localhost/test", echo=True)
assert e.scalar(select([literal_c
do you mean to say r'\\' there ?
On Jun 27, 2013, at 9:11 PM, Burak Arslan wrote:
> On 06/27/13 13:41, Simon King wrote:
>> Remember that Python also has its own string escaping. When you write
>> a literal '\\' in Python, you are creating a string containing a
>> single backslash.
>
>
> Hi S
On 06/27/13 13:41, Simon King wrote:
> Remember that Python also has its own string escaping. When you write
> a literal '\\' in Python, you are creating a string containing a
> single backslash.
Hi Simon,
I'm aware of that. My issue is that SQLAlchemy produces an invalid query
for .like('\\') i
You shouldn't need to write special code for this, have you tried changing
the escape character?
e.execute(t.select(t.c.a.like('\\', escape="~"))
where ~ could be any substitute escape character.
I don't have Postgres currently available, but their docs also state that
and empty string will disa
On Fri, Jun 28, 2013 at 11:05 AM, Burak Arslan
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 be
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 sqlalch
On Fri, Jun 28, 2013 at 2:11 AM, Burak Arslan
wrote:
> On 06/27/13 13:41, Simon King wrote:
>> Remember that Python also has its own string escaping. When you write
>> a literal '\\' in Python, you are creating a string containing a
>> single backslash.
>
>
> Hi Simon,
>
> I'm aware of that. My is
On Thu, Jun 27, 2013 at 11:01 AM, Burak Arslan
wrote:
> Hi,
>
> First, some background:
>
> psql (9.2.4)
> Type "help" for help.
>
> somedb=# create table a(a varchar(5));
> CREATE TABLE
> somedb=# insert into a values (E'\\');
> INSERT 0 1
> somedb=# select * from a where a = '\';
> a
> ---
> \
Hi,
First, some background:
psql (9.2.4)
Type "help" for help.
somedb=# create table a(a varchar(5));
CREATE TABLE
somedb=# insert into a values (E'\\');
INSERT 0 1
somedb=# select * from a where a = '\';
a
---
\
(1 row)
somedb=# select * from a where a like '\';
ERROR: LIKE pattern must not