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 seems to work, but just wondering if I need to implement any other function that will be complete. For example: python_type. Do you need the following? When will it be called and how can I explicitly call and check if it works?
def python_type(self):
return IPAddress
balki source
share