On creating all tables using alembic for migrations and then truncate any 
empty table gets completed quickly, BUT once lambda function is triggered 
to insert some data in a table through SQLAlchemy ORM Session query (as 
given below) and then truncate the table takes very much time. Where is the 
problem?

```
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

engine = create_engine("mysql+pymysql://....")
Session = sessionmaker(bind=engine)

def add_user():
    session = Session()
    session.add(User(**{'user_id': 1, 'name': 'user name'}))
    session.close()
    session.bind.dispose()

```

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/061a633a-55a5-40df-9726-069f770d99e9n%40googlegroups.com.

Reply via email to