Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am facing a problem while creating a table in mysqldb using python like this:

cursor.execute("CREATE TABLE IF NOT EXISTS %s ( tweetId VARCHAR(100) NOT NULL, tweet VARCHAR(180) NOT NULL, PRIMARY KEY(tweetId) )",('Tutulive')) .

I am getting this error:

_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 syntax to use near ''Tutulive' ( tweetId VARCHAR(100) NOT NULL, tweet VARCHAR(180) NOT NULL, PRIMARY' at line 1")
share|improve this question

1 Answer

SQL parameters should not be used for metadata. Sanitize the value yourself and insert it into the string normally.

share|improve this answer
What do you mean by sanitize ? – user1460207 yesterday
1  

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.