Oracle to Mysql, I'm (still) lost...

duikboot arjen.dijkstraNoSpam at hccnet.nl
Mon Jan 19 07:14:11 EST 2004


Hello all,

I still can't convert Oracle tables to a Mysql database. See thread:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&threadm=mailman.
282.1073834719.12720.python-list%40python.org&rnum=1&prev=/groups%3Fsourceid
%3Dmozclient%26ie%3Dutf-8%26oe%3Dutf-8%26q%3Dpython%2Boracle%2Bmysql

The tables in Oracle and Mysql are the same. Is there anyone who can help me
with this?

Thanks in advance,

Arjen

#######code######
import cx_Oracle, MySQLdb
from time import time

tabellen=["machine", "machinegroup", "machines", "operation", "orders",
          "run", "step"]

tijd=time()
conO=cx_Oracle.connect("some/some")
cursO=conO.cursor()
conMy=MySQLdb.Connect("localhost", db="some")
cursMy=conMy.cursor()

for tabel in tabellen:
    cursO.execute("select * from " + tabel)
    cursMy.execute("truncate " + tabel)
    #print cursO.description
    a_oracle=cursO.fetchone()
    cursMy.execute("insert into %s values %s", (tabel, a_oracle))

conO.close()
conMy.close()
print "\n\nklaar in :\n"
print time()-tijd, " seconden\n\n"

#####error####
Traceback (most recent call last):
  File "A:/tabellen2.py", line 20, in ?
    cursMy.execute("insert into %s values %s", (tabel, a_oracle))
  File "E:\Python23\Lib\site-packages\MySQLdb\cursors.py", line 95, in
execute
    return self._execute(query, args)
  File "E:\Python23\Lib\site-packages\MySQLdb\cursors.py", line 114, in
_execute
    self.errorhandler(self, exc, value)
  File "E:\Python23\Lib\site-packages\MySQLdb\connections.py", line 33, in
defaulterrorhandler
    raise errorclass, errorvalue
ProgrammingError: (1064, 'You have an error in your SQL syntax.  Check the
manual that corresponds to your MySQL server version for the right syntax to
use near \'\'machine\' values ("\'230KM\'", "\' \'", "\'230KM\'",
"\'1980-01-01 00:')
>>>





More information about the Python-list mailing list