modified database acces wit sqlalchemy