What is the correct way to get the number or rows returned by this query? I'm specifically looking to see if no results are returned.
sql = 'SELECT count(*) from table WHERE guid = %s;'
data=[guid]
cur.execute(sql,data)
results = cur.fetchone()
for r in results:
print type(r) # Returns as string {'count': 0L} Or {'count': 1L}
type(r)
will not return as{'count': 0L}
. Most likely it'll print<type 'dict'>
or similar. – Aileen