I have implemented a custom type using process_bind_param in SQLAlchemy (from the docs):
process_bind_param
import sqlalchemy.types as types class MyType(types.TypeDec