[sqlalchemy] Re: Multiple sessions

2013-06-28 Thread Srini
Just to close my question: I tweaked few settings for innodb and seems pretty good already. The biggest is being: transaction_isolation = READ-COMMITTED Of course not for everyone but for my needs, this works perfectly. thanks On Thursday, June 27, 2013 8:36:51 PM UTC-7, Srini wrote: I

Re: [sqlalchemy] [psql] string escaping quirk in like clauses

2013-06-28 Thread Simon King
On Fri, Jun 28, 2013 at 2:11 AM, Burak Arslan burak.ars...@arskom.com.tr 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

Re: [sqlalchemy] [psql] string escaping quirk in like clauses

2013-06-28 Thread Burak Arslan
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

Re: [sqlalchemy] [psql] string escaping quirk in like clauses

2013-06-28 Thread Simon King
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

[sqlalchemy] Updating using a join - Wrong parameter substitution order

2013-06-28 Thread RedBaron
Hi, I am using SQLAlchemy - 0.8.1 Background - I have a table event which has a flag 'is_deleted'. This table has a composite primary key (sid,cid). There are many other tables related to event that store information regarding that event - e.g. iphdr. I want to give the user an option of

Re: [sqlalchemy] Updating using a join - Wrong parameter substitution order

2013-06-28 Thread Michael Bayer
On Jun 28, 2013, at 8:23 AM, RedBaron dheeraj.gup...@gmail.com wrote: But when I try to write it in SQLALchemy inner_q = session.queryEvent.sid.label('sid'),Event.cid.label('cid')).options(lazyload('*')).join(Event.iphdr).filter(IpHdr.ip_dst==func.inet_aton(192.168.2.10)).subquery()

Re: [sqlalchemy] Updating using a join - Wrong parameter substitution order

2013-06-28 Thread Michael Bayer
On Jun 28, 2013, at 10:14 AM, Michael Bayer mike...@zzzcomputing.com wrote: I've created http://www.sqlalchemy.org/trac/ticket/2768 for this, and to understand what's going wrong one needs to appreciate that UPDATE.. against multiple tables is a non-standard syntax, where different

Re: [sqlalchemy] Updating using a join - Wrong parameter substitution order

2013-06-28 Thread RedBaron
Thanks for the reply. I understand that update against multiple tables is non-standard. However, I think I am trying to update only one table (events). The equivalent of what I am trying to do is update event set is_deleted=1 where (sid,cid) in (select event.sid,event.cid from event join iphdr

Re: [sqlalchemy] Updating using a join - Wrong parameter substitution order

2013-06-28 Thread Michael Bayer
On Jun 28, 2013, at 10:26 AM, RedBaron dheeraj.gup...@gmail.com wrote: Thanks for the reply. I understand that update against multiple tables is non-standard. However, I think I am trying to update only one table (events). The equivalent of what I am trying to do is update event set

Re: [sqlalchemy] HSTORE serialize/de-serialize incorrectly handles backslashes

2013-06-28 Thread Michael Bayer
On Jun 26, 2013, at 11:22 AM, Michael Bayer mike...@zzzcomputing.com wrote: OK just trying to get my head around the issue - psycopg2's parser does not have the backslashing issue right ? psycopg2's parser is fine. the fix is committed in master / rel_0_8 branch, thanks for the patch

Re: [sqlalchemy] twophase error sqlalchemy

2013-06-28 Thread Chris Withers
I wish zope.transaction or something that replaced it would return a Session subclass that replaces .commit and .rollback with calls to transaction.commit and transaction.abort rather than raising an exception with one and silently doing the wrong thing with the other :-/ Chris On 26/06/2013

Re: [sqlalchemy] TypeError: unsupported operand type(s) for -: 'float' and 'datetime.datetime' when subtracting DateTime columns directly with MySQL database

2013-06-28 Thread Michael Bayer
On Jun 28, 2013, at 4:20 PM, Ɓukasz Fidosz virh...@gmail.com wrote: Hi, When subtracting DateTime columns in query, like: session.query((Foo.datetime1 - Foo.datetime2).label('diff')) SQLAlchemy tries to handle result as timedelta but MySQL returns float as a result so it crashes with

Re: [sqlalchemy] [psql] string escaping quirk in like clauses

2013-06-28 Thread Mike Conley
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