KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to know how to know, given an object, if it is an instance of an sqlalchemy mapped model. Normally, I would use isinstance(obj, DeclarativeBase). However, in this scenario, I do not have the DeclarativeBase class used available (since it is in a dependency project). I would like to know what is the best practice in this case. class Person(DeclarativeBase): __tablename__ = "Persons" p = Person() print isinstance(p, DeclarativeBase) #prints True #However in my scenario, I do not have the DeclarativeBase available #since the DeclarativeBase will be constructed in the depending web app #while my code will act as a library that will be imported into the web app #what are my alternatives?
Tags (comma-separated)
Save Edits
Cancel