turbodbc
turbodbc copied to clipboard
MySQL JSON column unsupported
Using: MySQL: 5.7 (also tried MemSQL 5.8) turbodbc: 2.7.0 Python: 3.5.2
Table definition:
Column | Type
-----------+---------
data | json
I'm able to write json data to the table using the execute method:
cursor = conn.cursor()
cursor.execute("INSERT INTO ExampleTable VALUES (?)", ['{"A": 1}'])
I then try to read the data I just wrote (after committing transaction and creating new cursor) :
cursor.execute("SELECT data FROM ExampleTable;")
And receive the following error:
RuntimeError: Error! Unsupported type identifier for column data @ NULLABLE UNKNOWN TYPE (precision 18446744073709551612, scale 0))
Hi! Thanks for the report. Could you try to cast the JSON field to VARCHAR as a workaround?
Hi! This works! Thanks for the suggestion.
It would be nice to have turbodbc support the JSON datatype explicitly to avoid such workarounds.
This works for me using the current master.
Using: Driver: MySQL ODBC 8.0 Unicode Driver turbodbc: 4.2.1 Python: 3.9.4
Table definition:
Column | Type
--------+-----
data | json (null)
>>> cursor.execute("select data from Table limit 1").fetchall()
[['{ my json data }']]