SQLAlchemy를 통해 대량 행을 삽입/업데이트해야합니다. 삽입 된 행을 가져옵니다. SQLAlchemy : 자동 닫기 방지
나는 session.execute와 함께 할 것을 시도 :>>> posts = db.session.execute(Post.__table__.insert(), [{'title': 'dfghdfg', 'content': 'sdfgsdf', 'topic': topic}]*2)
>>> posts.fetchall()
ResourceClosedError Traceback (most recent call last)
그리고 엔진 :
In [17]: conn = db.engine.connect()
In [18]: result = conn.execute(Post.__table__.insert(), [{'title': 'title', 'content': 'content', 'topic': topic}]*2)
In [19]: print result.fetchall()
ResourceClosedError: This result object does not return rows. It has been closed automatically.
같은 응답은 객체가 자동으로 종료 된 것입니다. 그것을 막는 방법?
감사합니다. – I159