How to have a declarative model of a (MySQL) VIEW? #1211
Unanswered
cnicodeme
asked this question in
Usage Questions
Replies: 0 comments 3 replies
-
I would not use |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
Using the declarative model, I have a class that represents a VIEW in my database.
The issue I'm having is that when I call Alembic to generate migration, it always tries to create me this table because it can't find it (since it doesn't exist, it's a view).
I tried to set the
__abstract__ = True
property, but when doing this, theMyModelClass.query
is then not defined, and I need it to query the database.Here's how I declare my Models:
And then my Model representing the View
I wonder if having
__abstract__
twice in the hierarchy is not the cause of the problem or how I can set__abstract__
and still havequery
.Thanks for your input!
Beta Was this translation helpful? Give feedback.
All reactions