Closed Raghav-254 closed 1 year ago
IMHO this is working as expected, None
is the Python equivalent of a SQL null value.
Yes, None
is equivalent to SQL null. But is it possible to remain it as null, because currently it is changing the dataset, and is against the SQL standard. Also other clients for example trino-cli keep this as it is and doesn't convert null to none.
If you want to retrieve results as strings you can disable the behaviour which maps results to Python type by enabling the legacy mode https://github.com/trinodb/trino-python-client#legacy-primitive-types.
Expected behavior
Null values in the dataset should remain as null.
Actual behavior
Null values are getting converted to None
Steps To Reproduce
You can take any dataset having null value, it will automatically get converted to None. For instance refer the below process:
CREATE TABLE IF NOT EXISTS null_data ( c1 row(id VARCHAR, id1 VARCHAR), c2 VARCHAR );
INSERT INTO null_data VALUES (ROW('a', 'b'), NULL);
INSERT INTO null_data VALUES (NULL, 'c');
select * from null_data
Expected output should have NULL values in it, but the NULL values got replaced by None.
Log output
No response
Operating System
NA
Trino Python client version
0.322.0
Trino Server version
NA
Python version
5.10
Are you willing to submit PR?