ODBC & DbiData problem
I have a problem for experienced programmers. The following code
should copy data between two different databases:
c1 = conn1.cursor(); c2 = conn2.cursor()
c1.execute("SELECT field1, field2 FROM table1")
rows = c1.fetchall()
c2.executemany('INSERT INTO table1 (field1=%s,field2=%s)', rows)
The problem is: field 'field2' is DATE type and after fetchmany()
method I got DbiDate object instead of string 'YYYY-MM-DD
HH:MM:SS'. So my code breaks because Python cannot
insert such object to another database.
I know how to convert this object to the correct string
(http://www.python.org/windows/OdbcHints.html) but it must be done for
every field in every row. :( So my question is: Is it possible to make
odbc module to *automatically convert* this field from DbiDate object
to string? Maybe is there any special parameter to set up? I do not
want to write special code to convert all such fields. It suppose, it
can be done more automatically by odbc module, bu I do not know
|All times are GMT. The time now is 08:15 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.