Simple SQL statement:
sql = "DROP TABLE IF EXISTS %s"
cursor.execute(sql, ("user_table",))
It fails with:
psycopg2.ProgrammingError: syntax error at or near "'user_table'"
LINE 1: DROP TABLE IF EXISTS 'user_table'
The single quotes in the SQL statement are the problem. If I run this it works just fine:
cursor.execute("DROP TABLE IF EXISTS user_table")