I am just getting my hand dirty with python, hence my question might look silly. Yeah, I have the following code as per of a class. The declared variable in python was to accepted input from the user and then cross checked the content of the variable with an POSTGRES SQL statement. See the code below;
def view_user(self):
self.contact_modify = input('Please enter name to modify : ')
contact_modify = self.contact_modify
try:
con = self.db_conn()
print('We are connected to the db now')
except:
print('I can not find your database connection here')
try:
print(contact_modify) # to check the content of the variable
con.execute("SELECT * FROM phone WHERE address_name = :'contact_modify'")
print(contact_modify) # To check the contents of the variable
while True:
row = con.fetchone()
if row == None:
break
print(row[1],row[2],row[3])
except:
print("Error displaying your data")
I can get the content of the declared variable named 'contact_modify' at all line of code where I print it, but my POSTGRES SQL is not getting the content hence my EXCEPT part of the code is been execute. I am on POSGRES-9.3 and python 3.4 on 64 Windows10 Machine.