[Flask] Registering Flask-SQLAlchemy models from an extension
david at davidbaumgold.com
Sun Feb 11 16:30:21 EST 2018
I’m the maintainer of Flask-Dance, and my extension has to deal with this problem, too. I decided to solve it by providing a mixin class, and directing developers to define their own ORM model by inheriting from that mixin class. Then, the developer must pass the defined ORM model back to a class I defined, that knows how to handle it.
Here’s the relevant documentation for my Flask extension: https://flask-dance.readthedocs.io/en/latest/backends.html#sqlalchemy
And here’s the docs for SQLAlchemy mixins: http://docs.sqlalchemy.org/en/latest/orm/extensions/declarative/mixins.html
Does that help?
On February 11, 2018 at 8:27:42 PM, Gergely Polonkai (gergely at polonkai.eu) wrote:
I want to create an extension that, among other things, defines ORM models. Being an extension, this means it is not me who defines the flask_sqlalchemy.SQLAlchemy object, so I canʼt write my model classes like
Is there a recipe for this scenario?
Thanks in advance,
Flask mailing list
Flask at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Flask