Cannot run a single MySQLdb execute....

Chris Angelico rosuav at
Thu Mar 28 05:00:17 CET 2013

On Thu, Mar 28, 2013 at 2:50 PM, Νίκος Γκρ33κ <nikos.gr33k at> wrote:
> I'am about to go nuts with python 3.2.3
> Do you see somehtign wrong with the following statement?
> cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) )
> data = cur.fetchone()
> because as you can see by visiting my webpage at it produces an error and i dont have  aclue why.
> Please help. i'am using MySQLdb

Is this the docs for the module you're using?
String constant stating the type of parameter marker formatting
expected by the interface. Set to 'format' = ANSI C printf format
codes, e.g. '...WHERE name=%s'. If a mapping object is used for
conn.execute(), then the interface actually uses 'pyformat' = Python
extended format codes, e.g. '...WHERE name=%(name)s'. However, the API
does not presently allow the specification of more than one style in

Note that any literal percent signs in the query string passed to
execute() must be escaped, i.e. %%.

Parameter placeholders can only be used to insert column values. They
can not be used for other parts of SQL, such as table names,
statements, etc.

What paramstyle are you using?


More information about the Python-list mailing list