2.0.6 and mx.DateTime

Ed Leafe <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
	I've just started a project that is running on an Ubuntu server with  
psycopg2 used to connect to a PostgreSQL 8.2 backend. I'm re-using  
some code that was written for psycopg 1, and expects any datetime  
values to be returned as mx.DateTime values, not Python datetime  
values. This works fine in psycopg1, but if I switch to psycopg2 on  
the same machine, I only get back Python datetimes.

	I googled a bit, and found the following solution:

import psycopg2
import psycopg2.extensions
psycopg2.extensions.register_type(psycopg2._psycopg.MXDATETIME)
psycopg2.extensions.register_type(psycopg2._psycopg.MXINTERVAL)
psycopg2.extensions.register_type(psycopg2._psycopg.MXDATE)
psycopg2.extensions.register_type(psycopg2._psycopg.MXTIME)

	However, when I run this code, I get:

File '/home/ed/testapp/model/__init__.py', line 5 in ?
  psycopg2.extensions.register_type(psycopg2._psycopg.MXDATETIME)
AttributeError: 'module' object has no attribute 'MXDATETIME'

	Why are these mx constants not defined? AFAIK, this is installed from  
regular apt-get repositories. And is there an alternate solution?


-- Ed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.