I know that similar questions have been asked, however I'm really trying to understand how generic fields are generated in SQLAlchemy.
I have a class / permissions table that I want to contain a field that can apply to any type of model.
I looked through examples and this blog post http://techspot.zzzeek.org/2007/05/29/polymorphic-associations-with-sqlalchemy/
Is it possible to have a common relationship without a separate table? Just saving object_type and id? Something like that:
class Permission(AbstractBase): user = relationship("User", backref=backref('permissions')) permission_type = column(String()) object =
I think just a very simple example would be appreciated!
Itβs also worth noting that I come from the background of Django!
thanks
source share