Well there are work around options to the restriction with SQLAlchemy that you mention here.
You can use SQLAlchemy core instead of ORM and write your models independent of web context.
Check out https://github.com/gouthambs/flask-blogging
for example!