Python MySQLdb variables as table names
问题 I have a syntax error in my python which which stops MySQLdb from inserting into my database. The SQL insert is below. cursor.execute("INSERT INTO %s (description, url) VALUES (%s, %s);", (table_name.encode("utf-8"), key.encode("utf-8"), data[key].encode("utf-8"))) I get the following error in my stack trace. _mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''four