1

This runs fine:

with conn.connection.cursor(name='migration_cursor') as ss_cur:
    ss_cur.execute("SELECT id, stuff FROM cart WHERE stuff_type={}".format(some_variable))

However, this fails:

from sqlalchemy.sql import text
with conn.connection.cursor(name='migration_cursor') as ss_cur:
    ss_cur.execute(text("SELECT id, stuff FROM cart WHERE stuff_type=:some_variable"), some_variable=some_variable)

with this error message:

psycopg2.OperationalError: cursor "migration_cursor" does not exist
Ryan Norton
  • 145
  • 1
  • 2
  • 8

0 Answers0