Add docs and example of using plain SQLAlchemy models with Flask-SQLAlchemy#791
Add docs and example of using plain SQLAlchemy models with Flask-SQLAlchemy#791e271828- wants to merge 2 commits intopallets-eco:masterfrom
Conversation
| from flask_sqlalchemy import SQLAlchemy | ||
|
|
||
| # We can control this via `PLAIN_SQLALCHEMY_BASE=true python3 external_use.py` | ||
| PLAIN_SQLALCHEMY_BASE = "true" in os.getenv("PLAIN_SQLALCHEMY_BASE", "false").lower() |
There was a problem hiding this comment.
I don't think runtime switching makes much sense for something like this...
There was a problem hiding this comment.
I don't think runtime switching makes much sense for something like this...
The obvious alternative is refactoring initialization to make model_class apply to generic models instead of only working properly (e.g. attaching query class) when flask_sqlalchemy.Model is subclassed.
Seems like people have been proposing patches to do that for several years, none of which have landed.
What would you suggest?
|
Closing for similar reasons to #629. This also seems overly complex. You can already use regular models with |
There are many examples of people struggling to work around this limitation in flask-sqlalchemy, including various issues and PRs like:
#269
#250
#629
This PR documents a simple solution to bi-directional compatibility.