holsety
holsety

Reputation: 323

mysql db insert error when using blob value

using python adbapi the insert a row in a table in mysql

like insert ,id is a int, value is a blob

db.runQuery("INSERT INTO t (id, blob_value) VALUES (%(id)s, %(blob_value)s)", \
{
    "id" : id,
    "blob_value" : blob_value
}

Traceback: <class '_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 INSERT INTO t (id, blob_value) VALUES (%(id)s, %(blob_value)s)",

and I think it could be a quote character - ' in the blob_value, is these the matter why it failed?

OK, the reason is the table name - "unlock" which is a key word of mysql.

Would any one help how to do delete a table named "unlock"?

Upvotes: 0

Views: 502

Answers (2)

octern
octern

Reputation: 4868

Just put backticks around the table name:

drop table `unlock`;

Upvotes: 1

Namphibian
Namphibian

Reputation: 12211

Short answers:

DROP TABLE `UNLOCK`
SELECT * FROM `UNLOCK`

Use the mighty `

Upvotes: 1

Related Questions