0

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.

2
  • What is reader? Is there anything in it? Commented Aug 14, 2016 at 13:36
  • It's an iterable with two entries. Commented Aug 14, 2016 at 13:38

1 Answer 1

1

the insertion was never executed.

table.insert({'key': 'value'}).execute()

fixes this problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.