Re: [DB-SIG] documenting whether or not the seq_of_parameters to executemany is expected to be run in order given

2023-04-09 Thread Tony Locke
My initial thought is that the driver must pass the executemany parameters on to the server without changing the order of the parameters. Maybe that should be explicitly stated in the spec. Once the server has the parameters then I think the behaviour becomes DBMS dependent. I guess my philosophy i

Re: [DB-SIG] intent of "numeric" paramstyle, wrt actual numbers not numerically ordered?

2022-12-12 Thread Tony Locke
Sorry I'm a bit late to all of this. Here's what pg8000 does, together with what it sends to PostgreSQL: cursor.execute("SELECT :1, :2", (6, 0)) # Sent to server: "SELECT $1, $2" # Result: ['6', '0'] cursor.execute("SELECT :2, :1", (6, 0)) # Sent to server: "SELECT $2, $1" # Result: ['0', '6']

Re: [DB-SIG] Adding Connection.autocommit as standard extension to DB-API 2.0 (PEP 249)

2022-11-04 Thread Tony Locke
Hello all, with pg8000 if autocommit is turned on while a transaction is in progress, the autocommit behaviour only takes effect after the current transaction has been explicitly committed or rolled back. Of the options given, I'd go for option 1, raising an exception. I don't like the idea of SQL

Re: [DB-SIG] Improved support for prepared SQL statements

2014-12-21 Thread Tony Locke
Mike, I agree. You quote: "The first time you pass a statement to the cursor's execute() method, it prepares the statement. For subsequent invocations of execute(), the preparation phase is skipped if the statement is the same.” This is basically what pg8000 does but I've found you need a couple

Re: [DB-SIG] Improved support for prepared SQL statements

2014-12-18 Thread Tony Locke
On the question of extending the DB-API to accommodate prepared statements, from my narrow point of view as a maintainer of pg8000 it's unnecessary, as pg8000 uses prepared statements for everything anyway. In later versions of Postgres, the query plan is potentially updated every time a prepared s

Re: [DB-SIG] how greedy should cursor.fetchmany be?

2014-06-11 Thread Tony Locke
Hi, I would say that a user of your driver would expect the full number of rows specified in fetchmany to be returned (if the rows are there). So my view would be to stick to PEP 249 in this case. Cheers, Tony. On 11 June 2014 02:06, Daniel Lenski wrote: > I'm writing a DBAPI module for a custo

Re: [DB-SIG] Prepared statements in python drivers

2014-03-27 Thread Tony Locke
Hi Daniele, the latest release of pg8000 (1.9.7) has (experimental) support for prepared statements, but takes an implicit approach rather than an explicit one. In the connect() function there's a boolean use_cache parameter which tells pg8000 to cache prepared statements, keyed against the SQL que

Re: [DB-SIG] asyncio support

2013-11-10 Thread Tony Locke
What sort of thing do you have in mind? Perhaps something where the execute() method returns immediately, and a callback function is called when the query is complete? This could be implemented in a library on top of DB-API. But should it be part of the spec? Cheers, Tony. On 25 October 2013 0

Re: [DB-SIG] Iterable cursor as part of core rather than an extension in DBAPI 3

2013-11-10 Thread Tony Locke
On 25 October 2013 11:31, Daniele Varrazzo wrote: > On Thu, Oct 24, 2013 at 10:57 AM, Tony Locke wrote: > > Hi, in DBAPI 3 is there a plan to bring the 'iterable cursor' extension > into > > the core? Looking at https://wiki.python.org/moin/DbApi3 I couldn'

[DB-SIG] Iterable cursor as part of core rather than an extension in DBAPI 3

2013-10-24 Thread Tony Locke
Hi, in DBAPI 3 is there a plan to bring the 'iterable cursor' extension into the core? Looking at https://wiki.python.org/moin/DbApi3 I couldn't see anything. The reason I ask is that I'm noticing on PG8000 that the time taken to execute the warn() for each call to next() is significant for iterati

Re: [DB-SIG] DBAPI 3.0: Unified parameter style

2013-09-22 Thread Tony Locke
ity. Postgres is pretty much alone in > using numeric, where several other popular databases all use qmark. > The most important reason for leaving the .paramstyle attribute in place > is so that Postgres applications need not be re-written -- we assume that > anyone who writes a P

[DB-SIG] DBAPI 3.0: Unified parameter style

2013-09-15 Thread Tony Locke
Hi, I'm a contributor to the PG8000 Postgres driver: https://github.com/mfenniak/pg8000/tree/py3 Having read the interesting DBAPI 3.0 wiki page: https://wiki.python.org/moin/DbApi3 I thought I'd give a suggestion for unified parameters. Apologies if this has been suggested before, I did have a