0

The code currently checks for type(bol)==bytearray, but how can I get it to do the same for longtext columns? I've tried use_pure = true/false as well as raw = true/false. I have mysql-python-connector 8.0.6 installed, running python 3.5.4

it will return b'data' vs data for longtext columns

class MyConverter(mysql.connector.conversion.MySQLConverter):

    def row_to_python(self, row, fields):
        row = super(MyConverter, self).row_to_python(row, fields)

        def to_unicode(col):
            if type(col) == bytearray:
                return col.decode('utf-8')
            
            return col

        return[to_unicode(col) for col in row]
snakecharmerb
  • 47,570
  • 11
  • 100
  • 153
Mat
  • 1
  • 2
  • I can't reproduce this - can you provide a [mre]? Ideally including a `SHOW CREATE TABLE` and the connection arguments. – snakecharmerb Jan 09 '21 at 10:04
  • did you try this: https://stackoverflow.com/a/49463021/4225972? Also you can just add a `.decode()`. – xtlc Jan 09 '21 at 10:06

0 Answers0