[DB-SIG] WHat's the status of DB modules and datetime.py supp ort?

Kevin Jacobs jacobs at penguin.theopalgroup.com
Fri Jan 2 09:29:30 EST 2004


On Fri, 2 Jan 2004, Federico Di Gregorio wrote:
> exactly. let's start with a first very simple proposal that, imho, will
> improve the dbapi a lot:
> 
> objects returned in result sets should be directly useable as bound
> variables, without needing a call to wrapping functions/constructors.
> e.g., if datefield is of (any) date type and curs is a cursor:
> 
> curs.execute("INSERT into test VALUES (%s)", (module.DateFromTicks(x),))
> curs.execute("SELECT datefiled from test")
> d = curs.fetchone()[0]
> curs.execute("INSERT into test VALUES(%s)", (d,))

This proposal does not address the needs of those that:

  1) need to take data from one DB-API driver to another driver or backend
     database.
  2) have inherently ambiguous DB->Python type mappings
  3) like the fact that DB-API adapters return builtin Python types in most 
     cases (if only for efficiency reasons since they have their own type
     or OR mapping systems built upon DB-API).

Thus, this proposal should be a use-case for a type mapping extension for
input and output variables, but is not general enough to be a stand-alone,
mandated feature.

-Kevin

-- 
--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (440) 871-6725 x 19         E-mail: jacobs at theopalgroup.com
Fax:   (440) 871-6722              WWW:    http://www.theopalgroup.com/




More information about the DB-SIG mailing list