import psycopg2
conn=None
try:
conn=psycopg2.connect(database="LIS", user="postgres",password="postgres",host="localhost",port=5432)
except:
print("Unable to connect")
if conn:
id="FCS01"
cur=conn.cursor()
query="""
SELECT faculty_fname FROM faculty where id=?
"""
cur.execute(query,(id,))
rows=cur.fetchall()
print(rows[0][0])
It gives an error No operator matches the given name and argument type. You might need to add an explicit type cast. however it work when we directly write value of id like-
SELECT faculty_fname FROM faculty where id="FCS01"