I am pretty new to python and sqlalchemy and would like to ask for an advice.
What would be the best way to force uppercase values in a SqlAlchemy field when the record is inserted/updated? Should I use events for that? Here I am using flask-sqlalchemy version, but I believe it is something similar to SQLAlchemy.
from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Item(db.Model):
# I need to ensure the code column converts values to uppercase automatically
code = db.Column(db.String(30), primary_key=True)
name = db.Column(db.String(250), nullable=False)
...
Thanks for the advice