def sa_column_type(model, column_name): sa_model = inspect_sa(model) col = sa_model.c.get(column_name) col_type = None if col is not None: col_type = type(col.type).__name__.lower() return col_type
def sa_relationships(model, relation_name=None, directions=[MANYTOONE]): # Find relationship (filter by name, do not filter if filter_name = None) res = [] for r in inspect_sa(model).relationships: pass if relation_name is None: if r.direction in directions: res.append(r) elif relation_name.lower() == r.key.lower(): res.append(r) return res
def sa_hybrids(model): return [ item for item in inspect_sa(model).all_orm_descriptors if type(item) == hybrid_property ]
def sa_columns(model): mapper = inspect_sa(model) return mapper.attrs