Adding dynamic access control using SQLAlchemy