Psycopg2 date problems: "Can't adapt"

Gerhard Häring gh at ghaering.de
Fri Oct 21 14:19:58 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Steve Holden wrote:
> I'm trying to copy data from an Access database to PostgreSQL, as the 
> latter now appears to work well in the Windows environment. However I'm 
> having trouble with date columns. [...]
> Here's the problem in a nutshell:
> 
>  >>> d
> <DateTime object for '2003-10-02 00:00:00.00' at af9be0>
>  >>> ocurs.execute("DELETE FROM Lines")

This repr looks like a mxDateTime object. psycopg does include adapters
for mxDateTime, but in order for them to be built, the mxDateTime
sources and headers must be made available at psycopg build time
(because it interfaces mxDateTime at the C extension level, unlike most
if not all other Python DB-API adapters).

A quick look at its setup.py reveals a have_mxdatetime variable and a
check that decides wether to build with mxDateTime support or not. So,
if it does not find mxDateTime, it builds without support for it. Which
is apparently what you're experiencing.

HTH,

- -- Gerhard
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDWTFOdIO4ozGCH14RAgMyAJkB7gV88qhsmLmiMTCKXEDCbmjclACdEiW0
S56KM6ArQRUqP+jel2dC14M=
=cExi
-----END PGP SIGNATURE-----



More information about the Python-list mailing list