[DB-SIG] API suggestion: expose 'quote' method

Harald Meland Harald.Meland at usit.uio.no
Fri Jun 6 02:28:21 EDT 2003

[Kevin Jacobs]

> On Thu, 5 Jun 2003, M.-A. Lemburg wrote:
>> 2. quote(dataobject, datatype) -> quoted SQL literal
> -1 for inclusion in DB-API
> +1 for a higher-level API.  I'll even volunteer to manage such a project. 
>    The only painful side is that every DB-API driver, even those for the same
>    backend database, uses different backend type codes.

I seem to remember that the question of having all DB-API drivers
derive (most of) their types from some common, distributed-with-python
non-DBMS-specific DB-API module, has come up here before:

However, I'm unable to either a) locate that discussion in the
archives or b) recollect what conclusion one (I hope) eventually
reached on this question.

Of course, this wouldn't work equally well for *all* types; if
e.g. the DBMS-independent module doesn't have a specific superclass
for e.g. 'distance', while DBMS X does indeed have a type for such
values, then the writers of two different X drivers wouldn't
necessarily agree on which superclass their driver's class should be
based on.  A possible workaround is for the DBMS-independent module to
include a separate type for "types not covered elsewhere", and require
compliant drivers to derive all their "uncommon" driver-specific types
from this.

More information about the DB-SIG mailing list