Invalid syntax when using PyMySQL
<p>I'm learning using Python with MySQL. The same query works differently between Mysql and PyMySQL. For example: In MySQL console I have a table named "pages" </p>

<pre><code>INSERT INTO pages (title,content) VALUES ("test title","test content")
</code></pre>

<p>And this works. In Python, I import PyMySQL, I create a connection and then type <code>cursor = "cur"</code>. When I run:</p>

<pre><code>cur.execute("INSERT INTO pages (title,content) VALUES ("test title","test content")")
</code></pre>

<p>.. it raises an error : invalid syntax. But when I try this with the place holder:</p>

<pre><code>cur.execute("insert into pages (title,content) values (%s,%s)",("test title","test content"))
</code></pre>

<p>Then it works! So I was confused why same query work in MySQL but not in python,and does It means I should always use place holder when using PyMySQL?</p>

<p>Thanks</p>