-
-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with STI: __tablename__ automatically set (unwanted behaviour) #481
Comments
BTW, I've just noted that it's happening only with Flash-SQLAlchemy==2.2 (no problems at all with 2.1 version). |
This is odd, because the tests for single table inheritance pass. I'll add it to the 2.2.1 milestone. |
I've just discovered that it becames broken on f4662ad. |
@davidism, I've just comitted the test for single table inheritance setup (dizpers@d75506b). It checks that And in the meantime there are 2 facts:
So, it seems that problem is something more than just |
The Veripeditus team and I just spent a full month finding out why everything broke all over the place, and it turned out to be this very bug, which breaks not only single table inheritance, but also joined table inheritance in our case (but that might be because we configure the polymorphic mapper with some advanced magic). |
I believe I have a solution for this. I changed the tablename definition as follows:
The noticeable difference is that I explicitly set |
Hey, guys.
I'm using:
And have the problem, originally described in this SO question. My models setup looks like the following:
I want to use Single Table Inheritance (STI). So expected output of the
print(ItemB.query)
statement is something like:And at the same time I'm getting:
@univerio (@univerio, is it you? 😃 ) has pointed that Flask-SQLAlchemy automatically set
__tablename__
attribute. It means that my model setup, presented above, doesn't follow STI model.Is there any way to disable such behaviour by default? From my POV that behaviour sounds like a wrong approach, having a developer (how doesn't know that fact) to spend hours to understand why something isn't working.
Thanks.
The text was updated successfully, but these errors were encountered: