Re: [DB-SIG] autocommit support in pep-249

2011-09-13 Thread Daniele Varrazzo
On Mon, Sep 12, 2011 at 11:20 PM, Chris Clark wrote: > I was discussing with someone today autocommit support and found an area of > pep-249 where I think we could improve the wording (and the spec): Agreed, it would have been long due. The quick survey I did when we introduced the session in ps

Re: [DB-SIG] autocommit support in pep-249

2011-09-13 Thread Vernon Cole
> Properties are just the right tools for this > task, and appear to be the most used solution in popular drivers. > I think that term "attributes" is more commonly used, rather than "properties", but I agree completely. "conn.autocommit = True" seems pythonic, as does "if not conn.autocommit". G

Re: [DB-SIG] autocommit support in pep-249

2011-09-13 Thread Chris Clark
Vernon Cole wrote: Properties are just the right tools for this task, and appear to be the most used solution in popular drivers. I think that term "attributes" is more commonly used, rather than "properties", but I agree completely. "conn.autocommit = True" seems pythonic, as does "if not

Re: [DB-SIG] autocommit support in pep-249

2011-09-13 Thread Joshua D. Drake
On 09/13/2011 09:39 AM, Chris Clark wrote: Vernon Cole wrote: Properties are just the right tools for this task, and appear to be the most used solution in popular drivers. So I think we have 3 people each advocating slightly different options for what to do when changing auto commit option

Re: [DB-SIG] autocommit support in pep-249

2011-09-13 Thread Chris Clark
Joshua D. Drake wrote: On 09/13/2011 09:39 AM, Chris Clark wrote: Vernon Cole wrote: Properties are just the right tools for this task, and appear to be the most used solution in popular drivers. So I think we have 3 people each advocating slightly different options for what to do when cha

Re: [DB-SIG] autocommit support in pep-249

2011-09-13 Thread Joshua D. Drake
On 09/13/2011 10:53 AM, Chris Clark wrote: Just to throw some PostgreSQL two cents in here. It should not be legal to change transaction state once a transaction has begun. The "driver" should throw an error if that is tried. It shouldn't even reach the database. Consider: conn.begin() insert

[DB-SIG] pyPgSQL updates

2011-09-13 Thread Eric Soroos
Hello, It appears that pyPgSQL has been abandoned and Postgresql is starting to pass it by. I've sent a note to the pyPgSQL dev list and gotten no response. So I'm doing a bit of maintenance now. I've worked up some changes to the quoting to allow it to use the new to 9.0 hex encoding for by

Re: [DB-SIG] autocommit support in pep-249

2011-09-13 Thread Michael Bayer
On Sep 13, 2011, at 2:39 PM, Joshua D. Drake wrote: > > Oh now that is interesting. Hmmm... perhaps conn.autocommit() is actually a > synonym for conn.begin() except that it sets the autocommit property? So we > would have two semantics: > > conn.begin() -- Starts a transaction, will not comm

Re: [DB-SIG] autocommit support in pep-249

2011-09-13 Thread Daniele Varrazzo
On Tue, Sep 13, 2011 at 6:53 PM, Chris Clark wrote: > You made an interesting comment on the autocommit request, "It shouldn't > even reach the database". I think you are saying the "set auto commit on" > request should not be sent to the DBMS and be handled by the driver when > there are open tr

Re: [DB-SIG] autocommit support in pep-249

2011-09-13 Thread Michael Bayer
On Sep 13, 2011, at 6:01 PM, Daniele Varrazzo wrote: > > I think with Postgres the situation is slightly easier, as there is no > "non transaction" statement: any statement including DML is > transactional except a couple (such as CREATE DATABASE) that would > raise an error if run inside a tran

Re: [DB-SIG] autocommit support in pep-249

2011-09-13 Thread Joshua D. Drake
Hello, So, I have been a little out of the loop on DBAPI2 for a while. I just went back and read it and would like to change my argument a bit. (For some bizarre reason I was thinking that .begin() was part of the spec). It seems to me that the default behavior as it is implicit, should not

Re: [DB-SIG] autocommit support in pep-249

2011-09-13 Thread Michael Bayer
On Sep 13, 2011, at 9:15 PM, Joshua D. Drake wrote: > > conn=psycopg2.connect("dbname='foo' user='dbuser', AUTOCOMMIT=TRUE) > cur = conn.cursor() > cur.execute("""INSERT""") > cur.execute("""SELECT * from bar""") > cur.begin() > cur.execute("""INSERT""") > cur.commit() > cur.close() > > Is much