Previous version of code wrote fine with Python 2.7 to AWS MySQL Version 8 with the following:
"""INSERT INTO test_data(test_instance_testid,
meas_time, data_type_name, value, corner_case, xmit, string_value) VALUES('15063', '2021-03-19 20:36:00', 'DL_chamber_temp', '23.4', 'None', 'None', 'None')"""
But now, porting to Python 3.7 to the same server I get this:
pymysql.err.InternalError: (1366, "Incorrect integer value: 'None' for column 'xmit' at row 1")
This makes sense since it is a str value 'None' and not Python type None (although it used to work).
It is legal to fill these columns as NULL values--that is their default in the test_data table.
If I change the code and set the values to Python None, I get a different error which I don't understand at all:
"""INSERT INTO test_data(test_instance_testid,
meas_time, data_type_name, value, corner_case, xmit, string_value) VALUES('15063', '2021-03-19 20:36:00', 'DL_chamber_temp', '23.4', None, None, None)"""
pymysql.err.InternalError: (1054, "Unknown column 'None' in 'field list'")
I really appreciate any help or suggestions. Thanks, Mike
Thanks for the help! Yes, NULL does work, but I'm stuck on how to handle value types on the fly within my method. Depending on the call I need to write a quoted value in one case and non-quoted NULL on others. For some reason my old code (illogically!) worked. I've tried everything I can think of without any luck. Any thoughts on how to do this?
NULLwork instead?