Traceback (most recent call last):
File "/app/main.py", line 324, in that_function
links = cur.fetchall()[0]
File "/app/.heroku/python/lib/python3.10/site-packages/psycopg2/extras.py", line 104, in fetchall
res = super().fetchall()
psycopg2.ProgrammingError: no results to fetch
I don't understand why I get this exception in this code:
cur.execute(
"SELECT EXISTS(SELECT 1 FROM images where link = %s)", (original_url,)
)
links = cur.fetchall()[0]
What is the logical error in this? What's weird is in my infinite looping Python script, this happens randomly. The database is updated throughout the script however, so I'm not sure what is causing it.
no results to fetch. Can't find the reason.