I have a class that I'm trying to keep history of attribute changes. Up until now we use to have make_versioned(user_cls=None) and that would work in the sense that you could later access db_object.versions[i].user, however, this is not the right user that has made changes. It only takes the user from the database relationship it seems.
We are using Keycloak for user authorization and have an api model for KeycloakToken (but no database model) with fullname, username and email. Somehow the username from Keycloak should be used but simply.
Writing make_versioned(user_cls=KeycloakToken) gives
in Transaction sa.inspect(user_cls).primary_key[0].type, ^^^^^^^^^^^^^^^^^^^^ File "/repo/foo/bar/.venv/lib/python3.11/site-packages/sqlalchemy/inspection.py", line 152, in inspect raise exc.NoInspectionAvailable( sqlalchemy.exc.NoInspectionAvailable: No inspection system is available for object of type <class 'pydantic.main.ModelMetaclass'>
And if I do make_versioned(user_cls=User) it's circular import error.
What do I do here?