trinodb / trino-python-client

Python client for Trino
Apache License 2.0
328 stars 163 forks source link

Support for time, datetime, json, real, double types #202

Closed lpoulain closed 2 years ago

lpoulain commented 2 years ago

This PR adds support for time, datetime, json, read and double Trino types when querying for some rows.

The time and datetime required some data massaging:

mdesmet commented 2 years ago

The goal of this code is similar as what is implemented for experimental_python_types. The idea behind using this flag is that it would not impact any existing code relying on the string output of the Trino API (backwards compatibllity).

Could you review the existing mapping code and correct any shortcomings that you may have fixed.

https://github.com/trinodb/trino-python-client/blob/951ad82b7a7571c99dddf4e35f66fb403f052c11/trino/client.py#L583-L651

AFAIK we didn't do unit testing for the types. So I think that's probably something we should keep.

mdesmet commented 2 years ago

As a general remark, please rebase instead of merge changes from master, otherwise you will introduce already implemented changes in your PR's commits.

lpoulain commented 2 years ago

Closing to split the PR is smaller chunks