Reputation: 1248
I have the following code:
engine = sqlalchemy.create_engine(connectstring, echo=_echo).connect()
md = sqlalchemy.MetaData(engine)
table = sqlalchemy.Table('table_name', md, autoload=True, autoload_with=engine)
_Session = sessionmaker(bind=engine)
session = _Session()
for row in reader:
table.insert({'key': 'value'})
session.commit()
Why does nothing get added to my table? The code runs, but the table is never updated.
Upvotes: 0
Views: 64
Reputation: 1248
the insertion was never executed.
table.insert({'key': 'value'}).execute()
fixes this problem.
Upvotes: 1