[Python-Dev] SQLite module for Python 2.5

Gerhard Haering gh at ghaering.de
Thu Oct 21 10:57:00 CEST 2004


On Wed, Oct 20, 2004 at 02:22:24PM -0300, Gustavo Niemeyer wrote:
> > [Me:]
> > So I decided to change the default behaviour and make PySQLite
> > typeless by default, too. Everything will be returned as a Unicode
> > string (the default might be user-configurable per connection).
> 
> I'm wondering if it would be possible to introduce a mechanism
> allowing one to *explicitly* set column conversion functions at
> query time. This would avoid having to manually convert rows on
> every access. [...]

In fact, this feature will be in the new API. If the "guess mode" is
active, then you will only have to set converters for columns that the
"guesser" doesn't get right.

For example:

    cu.typecasts = {"mycolumn": int}
    cu.execute("select a, b, c, func(a) as mycolumn from t1")

This will replace the "-- types" hack, which will only return if
there's real demand for it, for example if a ZOPE DA needs it.

-- Gerhard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.python.org/pipermail/python-dev/attachments/20041021/20f72ece/attachment.pgp


More information about the Python-Dev mailing list