Psycopg2 date problems: "Can't adapt"

Steve Holden steve at holdenweb.com
Sat Oct 22 05:03:02 EDT 2005


Gerhard Häring wrote:
> -----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.
> 
Indeed it does. I am using a pre-compiled installer. Many thanks for 
your help.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/



More information about the Python-list mailing list