Re: [DB-SIG] paramstyles, again (and now voting)

2007-06-21 Thread Carl Karsten
Carsten Haese wrote: > On Wed, 20 Jun 2007 22:59:18 -0500, Carl Karsten wrote >> "super simple" would be the new api. pretty easy is the wrapper >> for backwards computability. >> >> As complex as that set would be, it wouldn't be much worse than the >> current mess. > > That's why we're discu

Re: [DB-SIG] paramstyles, again (and now voting)

2007-06-21 Thread Carsten Haese
On Thu, 2007-06-21 at 07:31 -0500, Carl Karsten wrote: > Carsten Haese wrote: > > The advantages are clear: > > > > * Application code written against this spec can be sure that named/qmark > > styles are available, and there is a common API for choosing which one to > > use. > > That means less

Re: [DB-SIG] paramstyles, again (and now voting)

2007-06-21 Thread Carl Karsten
Carsten Haese wrote: > On Thu, 2007-06-21 at 07:31 -0500, Carl Karsten wrote: >> Carsten Haese wrote: >>> The advantages are clear: >>> >>> * Application code written against this spec can be sure that named/qmark >>> styles are available, and there is a common API for choosing which one to >>> us

[DB-SIG] what is: backwards compatibility

2007-06-21 Thread Carl Karsten
When we talk about backwards compatibility, I am wondering exactly what that means. I think my question is: should code that does not follow the dbapi2 spec be guaranteed to work? For instance, I know some of the dbapiv2 modules support more than one paramstyle, yet the spec really only allows

Re: [DB-SIG] paramstyles, again (and now voting)

2007-06-21 Thread Carsten Haese
On Thu, 2007-06-21 at 09:14 -0500, Carl Karsten wrote: > Carsten Haese wrote: > > On Thu, 2007-06-21 at 07:31 -0500, Carl Karsten wrote: > >> Carsten Haese wrote: > >>> The advantages are clear: > >>> > >>> * Application code written against this spec can be sure that named/qmark > >>> styles are a

Re: [DB-SIG] paramstyles, again (and now voting)

2007-06-21 Thread M.-A. Lemburg
[Please calm down a bit.] On 2007-06-21 16:14, Carl Karsten wrote: > Carsten Haese wrote: * APIs aren't forced to abandon "legacy" parameter styles so existing code written for existing APIs won't break. * No backwards compatibility wrapper is necessary. >>> I do not see t

Re: [DB-SIG] what is: backwards compatibility

2007-06-21 Thread Carsten Haese
On Thu, 2007-06-21 at 10:02 -0500, Carl Karsten wrote: > When we talk about backwards compatibility, I am wondering exactly what that > means. A module is backwards compatible if code using it won't break if the module is replaced with a newer version. > I think my question is: should code that

[DB-SIG] A slightly different paramstyle suggestion

2007-06-21 Thread Anthony Tuininga
I've been reading the arguments going back and forth over parameter styles and I have a different suggestion which might help us out of this morass -- or perhaps provide additional fodder for the flame war that appears to be starting -) Define the method for cursor.execute() as follows: def e

[DB-SIG] DB API extension suggestion

2007-06-21 Thread Anthony Tuininga
I have been recently playing with context managers and the new "with" statement added in Python 2.5. I would like to suggest the addition of the following methods to connections: def __enter__(self): return self def __exit__(self, excType, excValue, excTraceback): if excType is None and

Re: [DB-SIG] what is: backwards compatibility

2007-06-21 Thread Carl Karsten
Carsten Haese wrote: > On Thu, 2007-06-21 at 10:02 -0500, Carl Karsten wrote: >> When we talk about backwards compatibility, I am wondering exactly what that >> means. > > A module is backwards compatible if code using it won't break if the > module is replaced with a newer version. Even if it r

Re: [DB-SIG] DB API extension suggestion

2007-06-21 Thread Robert Brewer
Anthony Tuininga wrote: > I have been recently playing with context managers and the new "with" > statement added in Python 2.5. I would like to suggest the addition of > the following methods to connections: > > def __enter__(self): > return self > > def __exit__(self, excType, excValue, ex

Re: [DB-SIG] DB API extension suggestion

2007-06-21 Thread M.-A. Lemburg
On 2007-06-21 18:41, Anthony Tuininga wrote: > I have been recently playing with context managers and the new "with" > statement added in Python 2.5. I would like to suggest the addition of > the following methods to connections: > > def __enter__(self): > return self > > def __exit__(self,

Re: [DB-SIG] what is: backwards compatibility

2007-06-21 Thread Carsten Haese
On Thu, 2007-06-21 at 11:51 -0500, Carl Karsten wrote: > Carsten Haese wrote: > > On Thu, 2007-06-21 at 10:02 -0500, Carl Karsten wrote: > >> When we talk about backwards compatibility, I am wondering exactly what > >> that means. > > > > A module is backwards compatible if code using it won't br

Re: [DB-SIG] DB API extension suggestion

2007-06-21 Thread Carsten Haese
On Thu, 2007-06-21 at 10:41 -0600, Anthony Tuininga wrote: > I have been recently playing with context managers and the new "with" > statement added in Python 2.5. I would like to suggest the addition of > the following methods to connections: > > def __enter__(self): > return self > > def _

Re: [DB-SIG] what is: backwards compatibility

2007-06-21 Thread Carl Karsten
Carsten Haese wrote: > On Thu, 2007-06-21 at 11:51 -0500, Carl Karsten wrote: >> Carsten Haese wrote: >>> On Thu, 2007-06-21 at 10:02 -0500, Carl Karsten wrote: When we talk about backwards compatibility, I am wondering exactly what that means. >>> A module is backwards compatible if cod

Re: [DB-SIG] what is: backwards compatibility

2007-06-21 Thread Carsten Haese
On Thu, 2007-06-21 at 14:30 -0500, Carl Karsten wrote: > Carsten Haese wrote: > > On Thu, 2007-06-21 at 11:51 -0500, Carl Karsten wrote: > >> Carsten Haese wrote: > >>> On Thu, 2007-06-21 at 10:02 -0500, Carl Karsten wrote: > When we talk about backwards compatibility, I am wondering exact

Re: [DB-SIG] A slightly different paramstyle suggestion

2007-06-21 Thread Michael Kleehammer
I like the idea of using *args and **kwargs a lot. Not having to build a sequence is nice and is an option I already provide in pyodbc: cursor.execute("insert into t(?,?)", a, b) Using the two items to differentiate between qmark and named seems like a simple idea and does not require connecti

Re: [DB-SIG] DB API extension suggestion

2007-06-21 Thread Michael Kleehammer
I'm not sure if there is a need for context support at the moment. Almost all databases automatically rollback transactions if they are not committed before a connection is closed. In the pyodbc connection finalizer, I automatically issue a rollback if a commit didn't occur. Since CPython uses re

Re: [DB-SIG] DB API extension suggestion

2007-06-21 Thread Anthony Tuininga
On 6/21/07, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Thu, 2007-06-21 at 10:41 -0600, Anthony Tuininga wrote: > > I have been recently playing with context managers and the new "with" > > statement added in Python 2.5. I would like to suggest the addition of > > the following methods to connec

Re: [DB-SIG] paramstyles, again (and now voting)

2007-06-21 Thread Christoph Zwerschke
Carl Karsten schrieb: > >>> numeric -1 > >>> format -5 > >>> pyformat -2 > > To me that reads "remove them." 0 would have been "tolerate them." It seems the "format" and "pyformat" syntax will be abandoned in Python 3.0 anyway (in favor of yet another syntax) so that would be another rea

Re: [DB-SIG] DB API extension suggestion

2007-06-21 Thread Carsten Haese
On Thu, 2007-06-21 at 14:26 -0600, Anthony Tuininga wrote: > On 6/21/07, Carsten Haese <[EMAIL PROTECTED]> wrote: > > with api.connect(dbname) as conn: > >with conn.cursor() as cur: > > cur.execute(stmt) > > That's interesting but is it of much use? Connections and cursors > close themse

Re: [DB-SIG] DB API extension suggestion

2007-06-21 Thread Anthony Tuininga
On 6/21/07, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Thu, 2007-06-21 at 14:26 -0600, Anthony Tuininga wrote: > > On 6/21/07, Carsten Haese <[EMAIL PROTECTED]> wrote: > > > with api.connect(dbname) as conn: > > >with conn.cursor() as cur: > > > cur.execute(stmt) > > > > That's interes

Re: [DB-SIG] paramstyles, again (and now voting)

2007-06-21 Thread Dieter Maurer
Carl Karsten wrote at 2007-6-21 07:31 -0500: > ... >I did before: "only allow one style of parameter." But it got out voted, (or >not even on the ballot) and so I won't push for it anymore. > > >>> numeric -1 > >>> format -5 > >>> pyformat -2 > >To me that reads "remove them." 0 would have be

Re: [DB-SIG] DB API extension suggestion

2007-06-21 Thread Carsten Haese
On Thu, 2007-06-21 at 16:39 -0600, Anthony Tuininga wrote: > I have not released this publicly yet, no. It would be a good idea to > have agreement on this rather than have conflicting implementations. Indeed. I see two alternatives, modulo naming: 1) A connection method: with conn.transaction()