I am creating a session object using this
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
maiden_engine = create_engine(connection_url)
session = sessionmaker(maiden_engine)
connector = session()
Now for a certain use case, I want to get pyscopg2
cursor
object from this connector
object, is there a way this conversion can be achieved?
This is how you normally create a cursor object
import psycopg2
conn = psycopg2.connect(host, port, database, user, password, sslmode)
cursor = conn.cursor()
Note that this conversaion HAS to be made from
connector
object in the last line of first code snippet, I can not usemaiden_engine
or anything else.