[DB-SIG] API 3.0 limiting paramstyle to ['named', 'qmark'] is okay. ('format' is not desirable)

John Kennedy ktc.jkennedy at gmail.com
Mon May 20 00:40:01 CEST 2013

I have often thought that the human race would unite, were we only to be
attacked by Martians. To serve that end, I will sacrifice myself and any
credibility I might have otherwise retained to present such an attack here.

The one thing that the DBAPI group could do to make my wildest DBAPI dreams
come true in the next version would be to give me a single method on the
cursor object that guaranteed to function uniformly across all databases,
albeit at the expense of any "native" performance and reliability
advantages in the face of corner cases that I might otherwise have had.

In my dream world, I would call this "cur.sexecute".  The "sexecute" method
would give me a number of huge advantages in terms of code reuse, because,
without tracing through all of the code that might have instantiated the
cursor object now in front of me, I would KNOW that this object had a
"sexecute" method, and I would know (almost like a contract) that it would
behave as follows, consistently across my entire codebase:

- 1st param - my SQL - parameterized with "?"
- 2nd param - my parameters -- either guaranteed to require a particular
form of sequence nesting, or guaranteed to not care.
- return type - list of tuples

I am not intelligent enough to determine the side effects in such a large
user base as you folks have.  For those of you who have developed drivers
that are subclassable, there could be users who created their own
"sexecute" methods with profoundly different intentions than I have :-)

However, I can state the following positives with certainty:

- This would only require ME to change my existing code if I prefer to
maximize its re-usability in the face of database uncertainty.

- My teammates would remember the method name, even when they are forced to
edit in an environment that doesn't support code completion.

- As mentioned, tracing through inheritance and runtime hierarchies to
determine if "sexecute" would work would be unnecessary.

- You have either implemented this already, or can delegate to another
method in your implementation.

- Everyone would think you are hip for choosing such an awesome method name.

Humbly Yours,
J. Kennedy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/db-sig/attachments/20130519/8c8f85a4/attachment.html>

More information about the DB-SIG mailing list