Add some SQLAlchemy best practises

Had problem with non-commiting data, add "autoflush"