I am doing a select() from a SQLite database and then an insert:
engine = create_engine('sqlite:///testdb.db')
pending_data = Table('pending_data', metadata, autoload=True)
sel_pending = select([pending_data.c.a,
pending_data.c.b])
cp = list(engine.execute(sel_pending))
pending_data.insert().values(a=1, b=2).execute()
When my code executes the last line, I get this error:
sqlalchemy.exc.ResourceClosedError: This Connection is closed
From this, it seems that the connection might be closed after I do my list() operation. What's the proper way to do this set of operations?
Aucun commentaire:
Enregistrer un commentaire