I’m having some trouble passing in dynamic variables into my query. Please ignore the poor style. This is what I’m trying to run:
> sql = "SELECT COUNT(*) FROM artifacts WHERE " \
> "url = '%s' AND " \
> "source_id = '%s'"
> self.db.execute(sql, (url, source_id))
I get the error:
self.db.execute(sql)
AttributeError: execute
For the life of me, I can’t figure out why it’s throwing an attribute error. In the User Guide, the example clearly passes in an a correct attribute.
I’ve been following: http://mysql-python.sourceforge.net/MySQLdb.html
bites on lip eug.
Just for clarification is your self.db attribute a connection or a cursor. Because you can only call the execute on a cursor!
If your following this example then you can see that there is create a cursor from the connection attribute and this cursor contains the execute method.
here is a small example: