I am trying to save ipaddress in a table. Created a custom type as follows:
class MCastIP(sqlalchemy.types.TypeDecorator):
impl = sqlalchemy.types.Integer
def process_bind_param(self, value, dialect):
return int(IPAddress(value))
def process_result_value(self, value, dialect):
return IPAddress(value)
This seem to work fine but just wondering if I have to implement any other function to be complete. Eg: python_type. Is the following needed? When will this be called and how do I call explicitly and test it works?
def python_type(self):
return IPAddress