absent1706 / sqlalchemy-mixins

Active Record, Django-like queries, nested eager load and beauty __repr__ for SQLAlchemy
MIT License
749 stars 67 forks source link

Setup confusion, using declarative_base() #99

Closed peterfranzen closed 1 year ago

peterfranzen commented 1 year ago

I'm a little confused about how to integrate this into my project. This is a purely back-end project, so I'm not using Flask. I'm using the following:

from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class User(Base): ...

How do I integrate this into my classes? Simply trying to put it into the User class (e.g. User(Base, AllFeaturesMixin)) gives me an error of "TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases"

lekhnath commented 1 year ago

I am also confused. What is the solution here?

michaelbukachi commented 1 year ago

@lekhnath The Base class must be SQLAlchemy 2.0 compatible