File "a.py", line 213, in cb
mye("source mysqlcommands.txt")
File "a.py", line 209, in mye
cr.execute(c)
File "c:\python24\lib\site-packages\MySQLdb\cursors.py", line 163, in execute
self.errorhandler(self, exc, value)
File "c:\python24\lib\site-packages\MySQLdb\connections.py", line 35, in defau
lterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax
; check the manual that corresponds to your MySQL server version for the right s
yntax to use near 'source mysqlcommands.txt' at line 1")
thanks,
jack
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi,
this script:
fn='mysqlcommands.txt'
db=my.connect(user='root',passwd='mysql')
cr=db.cursor()
def mye(c):cr.execute(c)
mye('drop database if exists tmp')
mye('create database tmp')
mye('use tmp')
mye("source %s"%fn)
fails. isn't 'source' legal mySQL?
the traceback:
File "a.py", line 213, in cb
mye("source mysqlcommands.txt")
File "a.py", line 209, in mye
cr.execute(c)
File "c:\python24\lib\site-packages\MySQLdb\cursors.py", line 163, in execute
self.errorhandler(self, exc, value)
File "c:\python24\lib\site-packages\MySQLdb\connections.py", line 35, in defau
lterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax
; check the manual that corresponds to your MySQL server version for the right s
yntax to use near 'source mysqlcommands.txt' at line 1")
thanks,
jack
No, source is not valid SQL. It's something locally-interpreted by the mysql commmand-line client.