Skeleton sqlalchemy typedecorator


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. class ISIN(satypes.TypeDecorator):
  2. """Validate ISIN on input and convert ISIN to string on ingress, string to ISIN on egress"""
  3. impl = satypes.String
  4. def __init__(self, *args, **kargs):
  5. satypes.TypeDecorator.__init__(self, *args, **kargs)
  6.  
  7. def convert_bind_param(self, value, engine):
  8. return self.impl.convert_bind_param(value, engine)
  9.  
  10. def convert_result_value(self, value, engine):
  11. return self.impl.convert_result_value(value, engine)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.