Flask-SQLALchemy i have a model with columns:
class MyModel(db.Model):
def my_method1(self, arg1):
pass
a = Column(String(), primary_key=True)
Now i have a function which accepts Columns as argument to retrieve some information from them:
def get_column_info(column):
if column.primary_key:
return True
else:
return False
Note that this is just an example, the get_column_info does much more than that in reality.
Now i want to be able to access the originating model in my get_column_info function. That is i want to be able to call my_method1() from within get_column_info.
Is there a way i can retrieve the originating model from a column instance?