In my case I didn’t realize that you had to pass a tuple to cursor.execute. I had this:
cursor.execute(query, (id))
But I needed to pass a tuple instead
cursor.execute(query, (id,))
More Related Contents:
- pg_config executable not found
- psycopg2: insert multiple rows with one query
- Pandas read_sql with parameters
- Parameterized queries with psycopg2 / Python DB-API and PostgreSQL
- Passing table name as a parameter in psycopg2
- How to install psycopg2 with “pip” on Python?
- DatabaseError: current transaction is aborted, commands ignored until end of transaction block?
- error installing psycopg2, library not found for -lssl
- Error: pg_config executable not found when installing psycopg2 on Alpine in Docker
- How to set up a PostgreSQL database in Django
- Can’t install psycopg2 package through pip install on MacOS
- How can I use psycopg2.extras in sqlalchemy?
- psycopg2.OperationalError: FATAL: unsupported frontend protocol 1234.5679: server supports 2.0 to 3.0
- Psycopg2 image not found
- Can’t install psycopg2 with pip in virtualenv on Mac OS X 10.7
- psycopg2 installation error – Library not loaded: libssl.dylib
- Error Installing Psycopg2 on MacOS 10.9.5
- SQLAlchemy: engine, connection and session difference
- sqlalchemy.exc.NoSuchModuleError: Can’t load plugin: sqlalchemy.dialects:postgres
- Python/psycopg2 WHERE IN statement
- Create a Postgres database using python
- Python/postgres/psycopg2: getting ID of row just inserted
- Escape SQL “LIKE” value for Postgres with psycopg2
- How to set connection timeout in SQLAlchemy
- How to quote a string value explicitly (Python DB API/Psycopg2)
- Mac + virtualenv + pip + postgresql = Error: pg_config executable not found
- “Failed building wheel for psycopg2” – MacOSX using virtualenv and pip
- Psycopg2, Postgresql, Python: Fastest way to bulk-insert
- Use binary COPY table FROM with psycopg2
- How Postgresql COPY TO STDIN With CSV do on conflic do update?