[CONPY-68] jsonfield (longtext) returning as bytes Created: 2020-05-27 Updated: 2020-08-10 Resolved: 2020-08-10 |
|
| Status: | Closed |
| Project: | MariaDB Connector/Python |
| Component/s: | Generic |
| Affects Version/s: | 0.9.59 |
| Fix Version/s: | 1.0.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Luciano Barcaro | Assignee: | Georg Richter |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Internally, mariadb converts json columns to longtext, but all queries involving json columns are returning as bytes. Should return as string.
|
| Comments |
| Comment by Georg Richter [ 2020-06-15 ] | ||||||||||||
|
In MariaDB column type Json is an alias, it creates a column of type longtext with a binary collation. There the metadata contains a binary flag and will be converted to a byte array: $ mysql -ugeorg test --column_type_info -e"create table t1(a json);select a from t1"
To get a python string object, you need to modify your statement:
| ||||||||||||
| Comment by Georg Richter [ 2020-08-10 ] | ||||||||||||
|
Reopening this issue: If a BLOB has a non binary collation, it should be converted to unicode and the BINARY flag should be ignored:
| ||||||||||||
| Comment by Georg Richter [ 2020-08-10 ] | ||||||||||||
|
Fixed. Rev. 067a78dd13adae905cef6f6c18941d4cbcbd0b2e |