def serialize(model):
    """Transforms a model into a dictionary which can be dumped to JSON."""
columns = [c.key for c in class_mapper(model.__class__).columns]
return dict((c, getattr(model, c)) for c in columns)
serialized_labels = [serialize(label) for label in session.query(LabelsData
    ).filter(LabelsData.deleted == False)]
your_json = dumps(serialized_labels)
How to create sqlalchemy to json