Qmark in pymysql query
Question: I'm new to python, just moving from php5. I read about the qmark param
notation to prepare a query but I get the following:

    
    
    Traceback (most recent call last):
      File "t.py", line 10, in <module>
        cursor.execute("SELECT * FROM object WHERE otype = ?", ["user"])
      File "/usr/local/lib/python3.4/site-packages/pymysql/cursors.py", line 130, in execute
        query = query % self._escape_args(args, conn)
    TypeError: not all arguments converted during string formatting
    

Is that only for sqlite connector?

    
    
    import sys
    import pymysql
    
    try:
        connection = pymysql.connect(host="127.0.0.1", user="root", passwd="pass", db="xxx")
    except:
        sys.exit("Database connection error")
    
    cursor = connection.cursor()
    cursor.execute("SELECT * FROM object WHERE otype = ?", "user")
    
    for row in cursor:
       print(row)
    
    cursor.close()
    connection.close()
    


Answer: Yes. Unfortunately the DB-API specification left it up to each implementer to
choose the parameter. pysqlite chose the ?, and MySQLdb chose %s. Since pymsql
is a drop-in replacement for MySQLdb, it also uses %s.

