A Quick MySQL Question

Victor Subervi victorsubervi at gmail.com
Mon May 24 13:37:58 EDT 2010


Hi;
I have the following:

#        sql = 'alter table %s alter column %s set default "%%s";' % (store,
col)
#        cursor.execute(sql, colValue)
        cursor.execute('alter table %s alter column %s set default "%s";' %
(store, col, colValue))
        database.commit()

Now I don't like that third line, so I tried the commented out lines, but I
got an MySQLdb.OperationalError that the suggested default value could not
be inserted. However, when I printed it out and tried to insert directly, no
problem, and the 3rd line works fine. What gives?
TIA,
beno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100524/ed017a72/attachment.html>


More information about the Python-list mailing list