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

Fixed a regression caused by #361 where SQLAlchemy models with Mixin Classes raises AttributeError #385

Merged
merged 7 commits into from
Nov 6, 2023

Conversation

hasansezertasan
Copy link
Contributor

@hasansezertasan hasansezertasan commented Nov 6, 2023

Fixes #383 and partially fixes #369

There is a module called SQLAlchemy-Mixins, FastAP-Users uses mixins, and most probably any project that has +3 models with same primary key structure uses mixins, so its quite popular. @jowilf I believe we should patch the version immediately because many SQLAlchemy users will be using custom or third party mixins.

@jowilf
Copy link
Owner

jowilf commented Nov 6, 2023

Thanks! Can you add a test case to avoid this in future?

@hasansezertasan
Copy link
Contributor Author

hasansezertasan commented Nov 6, 2023

Thanks! Can you add a test case to avoid this in future?

Allright, I'm not very good at tests but I just altered models in the tests/sqla/test_sqla_and_pydantic.py file to use a mixin for ID columns. They did not break.

Edit: I also am not sure how to fail test this one.

Copy link

codecov bot commented Nov 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (41bc7f7) 100.00% compared to head (b06b855) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #385   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           72        72           
  Lines         5559      5559           
=========================================
  Hits          5559      5559           
Files Coverage Δ
starlette_admin/contrib/sqla/view.py 100.00% <100.00%> (ø)
tests/sqla/test_sqla_and_pydantic.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@jowilf jowilf left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution 🎉

starlette_admin/contrib/sqla/view.py Show resolved Hide resolved
starlette_admin/contrib/sqla/view.py Show resolved Hide resolved
@jowilf jowilf changed the title Fix #383 Fixed a regression caused by #361 where SQLAlchemy models with Mixin Classes raises AttributeError Nov 6, 2023
@jowilf jowilf merged commit 9646fbe into jowilf:main Nov 6, 2023
9 checks passed
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.

Bug: SQLAlchemy Joined Inheritance raises error Bug: SQLAlchemy models with Mixin Classes raises error.
2 participants