ming-zhang-SN commented on issue #31612: URL: https://github.com/apache/airflow/issues/31612#issuecomment-1775262395
TL;DR I encountered the same issue. Updating the presto-python-client to version 0.8.4 resolves it. Details: As previously discussed, the issue was due to the `cursor.description` being None within either `fetch_all_handler` or `fetch_one_handler`, which we believed shouldn't occur. After further investigation, I found that the description was None because the _query's columns were also None: [Link to 0.8.3 code on GitHub](https://github.com/prestodb/presto-python-client/blob/0.8.3/prestodb/dbapi.py#L196) This is because the columns are only assigned within the `fetch` function here: [Link to 0.8.3 code on GitHub](https://github.com/prestodb/presto-python-client/blob/0.8.3/prestodb/client.py#L559) Essentially, one must execute a fetch command, after which the columns will be assigned, preventing the description from being None. However, in the latest version of presto-python-client (0.8.4), a call to fetch has been added to the execute function: [Link to commit on GitHub](https://github.com/prestodb/presto-python-client/commit/08c2cca2f2b67fdf5a100bf87149d98552cdca9f#diff-7cf07a96d4968b2a9c2c25bba0bdb305f905a41a734588e879996225774d4338R539-R542) And the execute function is always called here: [Link to Apache Airflow code on GitHub](https://github.com/apache/airflow/blob/ef497bc3412273c3a45f43f40e69c9520c7cc74c/airflow/providers/common/sql/hooks/sql.py#L390) This occurs before either the fetch_all_handler or fetch_one_handler is invoked. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
