[DB-SIG] Some obscurity with paramstyle

Michael Bayer mike_mp at zzzcomputing.com
Mon Jul 18 16:15:17 CEST 2011


On Jul 18, 2011, at 8:54 AM, M.-A. Lemburg wrote:

> 
> For data input/output, the situation is difficult, since not
> all backends support Unicode, some only configuration dependent
> character sets and some others are basically ASCII/binary data
> only.

OK, but even those DBAPIs can present Python unicode objects on the user-facing side, at least as an option (the module global you mention speaks to this - I would suggest the parameter is available as a global and on the connection object).   If the only encoding available is "ascii", then that's all you have.

Of course bytes should be accepted as well, though some DBAPIs have problems with this.   I think passing unicode + an encoding is known at the global/connection level gives the widest latitude to the DBAPI itself in dealing with textual data.

> 
> We will likely have to introduce a new TEXT() constructor
> which maps data objects to text data and then takes care
> of the database specific encoding issues.
> 
> There are similar issues with float/decimal and date/time
> values.
> 
> It would be great if we could resolve all of these using
> a data type mapping facility that defines input and output
> mappings in an efficient and flexible way.

Several DBAPIs have these already, but particularly for the Decimal issue, it's critical that numerics aren't presented as Python floats before there is even a chance to extract the information.

> 
> -- 
> Marc-Andre Lemburg
> eGenix.com
> 
> Professional Python Services directly from the Source  (#1, Jul 18 2011)
>>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
> ________________________________________________________________________
> 
> ::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
> 
> 
>   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>           Registered at Amtsgericht Duesseldorf: HRB 46611
>               http://www.egenix.com/company/contact/
> _______________________________________________
> DB-SIG maillist  -  DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig



More information about the DB-SIG mailing list