Fixed sql to Python datatype issue