I was wondering if anybody knows how to split a column in sqlalchemy to create a calculated field.
Tried:
class Pupils(db.Model):
full_name = db.Column(db.Text) #Jonh Doe
@hybrid_property
def firstname(self):
return self.full_name.split(" ")[0]
However, I receive the error message:
AttributeError: Neither 'InstrumentedAttribute' object nor 'Comparator' object associated with Pupils.full_name has an attribute 'split'
I was wondering what I was doing wrong? My fingers are bloody from Googling...Captain! please help!