aiomysql
aiomysql copied to clipboard
allow extensions to escaping, for example numpy types
This expects that when you extend converts you do so using the default as a base dict. I've used it as follows to include escape support for a couple of numpy types.
mysql_converters = { numpy.int64: pymysql.converters.escape_int, numpy.float64: pymysql.converters.escape_float, }
Pretty sure encoders and decoders are dictionaries of different contents.
encoders is type -> conversion_function
decoders is mysql field bit -> conversion_function
I think what your after is extending the encoders dict so that if you do inserts with numpy objects it'll convert them to standard python ones