During development using the mysql.database Database class we noticed, that writing to columns of type json and type decimal is not working correctly with missing values.
The problem is, that the default value and missing values are not associated correctly.
When running this code on the real database with restriced priviliges, the writing did not work at all.
1st because '' is not a valid input for the decim column.
And the json column was not receiving any data, giving an error of the form 'Invalid JSON text: "Missing a name for object member." at position 1
In this example the writing did work, but the None values are not processed correctly.
For the decim column, the missing value should be \N (see https://stackoverflow.com/a/2675493 and the linked mysql docu) I think that may also be the solution for the json '' problem
During development using the mysql.database Database class we noticed, that writing to columns of type
json
and typedecimal
is not working correctly with missing values.I tried to create a reproduceable example
In conftest.py I added:
I also added a test
This returns a malspecified
df_in_db
The problem is, that the default value and missing values are not associated correctly.
When running this code on the real database with restriced priviliges, the writing did not work at all. 1st because
''
is not a valid input for the decim column. And the json column was not receiving any data, giving an error of the form'Invalid JSON text: "Missing a name for object member." at position 1
In this example the writing did work, but the None values are not processed correctly.For the decim column, the missing value should be
\N
(see https://stackoverflow.com/a/2675493 and the linked mysql docu) I think that may also be the solution for the json''
problem