ODBC and date

David beechd at gatsby.tafe.tas.edu.au
Wed Jun 13 07:54:39 EDT 2001


"Steve Holden" <sholden at holdenweb.com> wrote in message news:<urWTCDz8AHA.290 at cpmsnbbsa07>...
> "Maurice HUET" <m.huet at online.fr> wrote in message
> news:FYHU6.106$GJ3.438333 at nnrp3.proxad.net...
> > Hello,
> >
> >     I want transfert data from a progress database to a MySql database
>  with
> > python and the ODBC module. (Win plateform)
> >     How can I specify date selection in the SQL order ?
> >     The date data cause problem (dbidate type) when i want write tem in a
> > text file between then two database ?

MySQL uses an ISO <some magic number> format date. I have been using Marc
 Lemburg's ODBC driver which is very good (http://www.lemburg.com/python) and 
found that when using dates if it's necessary to set the dateformat for the 
cursor:

db = Connect(dsn, user, pwd)
c = db.cursor()    
c.datetimeformat=3

There are constants for the date formats so you can interpret the date in 
many ways.

David



More information about the Python-list mailing list