MySQL Forums
Forum List  »  Connector/Python

Re: Wrong number of arguments during string formatting
Posted by: Geert Vanderkelen
Date: March 12, 2013 05:44AM

(1) Here is prove that it does work:

>>> cnx = mysql.connector.connect(............)
>>> cur = cnx.cursor()
>>> cur.execute("SELECT %(name)s, %(name)s", {'name': 'ham'})
>>> cur.fetchall()
[(u'ham', u'ham')]

Please double check and if you believe you found a bug, report using bugs.mysql.com


(2) %s is a 'universal' placeholder. It's used for anything, strings, integers, datetime.datetime, .. (see PEP-249). If you provide an int, an int will be inserted.

Geert Vanderkelen
Software Developer at Oracle

Options: ReplyQuote


Subject
Written By
Posted
Re: Wrong number of arguments during string formatting
March 12, 2013 05:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.