Skip to content
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

🐛 Update/fix Base class in models.py #38

Merged
merged 1 commit into from
Jan 18, 2018
Merged

🐛 Update/fix Base class in models.py #38

merged 1 commit into from
Jan 18, 2018

Conversation

znatty22
Copy link
Member

Change Base to inherit only the model mixins (Base should not inherit db.Model)

If Base inherits db.Model then this is saying that Base is a db.Model/a
sqlalchemy declarative base. sqlalchemy will think that we are trying to
do single table inheritance, which I don't believe we are. We just want
a class representing the common columns across entities.

Even if we were trying to do single table inheritance, then we need to add
additional code to all child classes of Base to instruct sqlalchemy on
how to handle two entity models with the same column names.

See link for more details:
http://docs.sqlalchemy.org/en/latest/orm/extensions/declarative/inheritance.html

Verified

This commit was signed with the committer’s verified signature.
headtr1ck Michael Niklas
Change Base to inherit only the model mixins (Base should not inherit db.Model)

If Base inherits db.Model then this is saying that Base is a db.Model/a
sqlalchemy declarative base. sqlalchemy will think that we are trying to
do single table inheritance, which I don't believe we are. We just want
a class representing the common columns across entities.

Even if we were trying to do single table inheritance, then we need to add
additional code to all child classes of Base to instruct sqlalchemy on
how to handle two entity models with the same column names.

See link for more details:
http://docs.sqlalchemy.org/en/latest/orm/extensions/declarative/inheritance.html
Copy link
Contributor

@dankolbman dankolbman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@znatty22 znatty22 merged commit 23cf525 into master Jan 18, 2018
@znatty22 znatty22 deleted the fix/base-model branch January 18, 2018 18:15
@dankolbman dankolbman mentioned this pull request Apr 2, 2018
alubneuski pushed a commit that referenced this pull request Oct 11, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
🐛 Update/fix Base class in models.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants