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

D

duikboot

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:')
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top