In the case above I was trying to select only 1 result (WHERE id=:%d
), and then check if it had address
set. To do this, it is not a good idea to use self.link.fetchall()
because that returns a list with all results that can be used in a loop for example.
The correct function to use is self.link.fetchone()
which only return the dictionary. If you use:
row = self.link.fetchone()
then you can also use
print row["key"]
If you use
row = self.link.fetchall()
then you have to use
print row[0]["key"]