I understand this question has been asked many times but in my case I can't find a way to simply resolve it. I have a very basic fetchone() query as below:
conn = psycopg2.connect(
host=postgres_host,
database=postgres_database,
user=postgres_user,
password=postgres_password)
cur = conn.cursor()
cur.execute("SELECT * FROM videos WHERE status = %s" , (0))
result = cur.fetchone()
print(result[0])
exit
I am still getting the result which is the ID of my row cursor returning but right after print statement I get "'int' object does not support indexing"
I've been through Stackoverflow for an hour and tried all suggestions but can't find the right answer. Not sure using list is the best approach, as I see it returning a tuple is a very basic query. Any advice? Thanks