Fixing blob encoding/decoding issues with py3, using long correctly in sql tests