In your case the connector
variable is a <class 'sqlalchemy.orm.session.Session'>
object. Session
objects have a .bind
attribute which returns the <class 'sqlalchemy.engine.base.Engine'>
that is associated with the session.
Engine
objects have a .raw_connection()
method that returns (a proxy to) the raw DBAPI connection, and calling .cursor()
on that returns a raw DBAPI Cursor
object. Hence,
crsr = connector.bind.raw_connection().cursor()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…