<p dir="ltr">Thatʼs exactly how Flask-Login works (that extension is not even aware of the database).</p>
<p dir="ltr">I considered this path, too, and will probably go with that, as it lets the developer choose how to persist data, and wonʼt bind them to one specific solution.</p>
<p dir="ltr">However, Iʼm still interested in a solution to the original problem, so if anyone knows it, donʼt hesitate to reply :)</p>
<p dir="ltr">Best,<br>
Gergely</p>
<br><div class="gmail_quote"><div dir="ltr">On Sun, Feb 11, 2018, 22:30 David Baumgold <<a href="mailto:david@davidbaumgold.com">david@davidbaumgold.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div id="m_9020789358079360911bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">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.</div><div id="m_9020789358079360911bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="m_9020789358079360911bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Here’s the relevant documentation for my Flask extension: <a href="https://flask-dance.readthedocs.io/en/latest/backends.html#sqlalchemy" target="_blank">https://flask-dance.readthedocs.io/en/latest/backends.html#sqlalchemy</a></div><div id="m_9020789358079360911bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">And here’s the docs for SQLAlchemy mixins: <a href="http://docs.sqlalchemy.org/en/latest/orm/extensions/declarative/mixins.html" target="_blank">http://docs.sqlalchemy.org/en/latest/orm/extensions/declarative/mixins.html</a></div><div id="m_9020789358079360911bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="m_9020789358079360911bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Does that help?</div> <div><br></div>David Baumgold</div><div style="word-wrap:break-word;line-break:after-white-space"><br> <div id="m_9020789358079360911bloop_sign_1518384450296911872" class="m_9020789358079360911bloop_sign"></div> <br><p class="m_9020789358079360911airmail_on">On February 11, 2018 at 8:27:42 PM, Gergely Polonkai (<a href="mailto:gergely@polonkai.eu" target="_blank">gergely@polonkai.eu</a>) wrote:</p> </div><div style="word-wrap:break-word;line-break:after-white-space"><blockquote type="cite" class="m_9020789358079360911clean_bq"><span><div><div>





Hello,<br>
<br>
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
<div><br></div>
<div>class MyModel(db.Model):</div>
<div><br>
Is there a recipe for this scenario?</div>
<div><br></div>
<div>Thanks in advance,</div>
<div>Gergely </div></div></div></span></blockquote></div><div style="word-wrap:break-word;line-break:after-white-space"><blockquote type="cite" class="m_9020789358079360911clean_bq"><span><div><div>


_______________________________________________
<br>Flask mailing list
<br><a href="mailto:Flask@python.org" target="_blank">Flask@python.org</a>
<br><a href="https://mail.python.org/mailman/listinfo/flask" target="_blank">https://mail.python.org/mailman/listinfo/flask</a>
<br></div></div></span></blockquote></div></blockquote></div>