为什么enging.connect()不等于SQLAlchemy中的session.connection()?

时间:2017-08-09 09:30:44

标签: python sqlalchemy flask-sqlalchemy

db = SQLAlchemy(app)

print db.engine.connect()
print db.session.connection()
# <sqlalchemy.engine.base.Connection object at 0x7fb9daf01ad0>
# <sqlalchemy.engine.base.Connection object at 0x7fb9da0edcd0>
print db.engine.connect().connection.connection
print db.session.connection().connection.connection
# <_mysql.connection open to '*' at 2b30c30>
# <_mysql.connection open to '*' at 2b1ab80>

为什么engine.connect()不等于session.connection()?此代码使用Flask-SQLAlchemy。

0 个答案:

没有答案