Skuratovskyi opened a new issue #21125:
URL: https://github.com/apache/airflow/issues/21125
### Apache Airflow version
2.2.3 (latest released)
### What happened
When I use Trino provider I use "run" method in TrinoHook, because I need
run "create table" query.
But these queries are not performed on Trino server.
### What you expected to happen
I expected, that queries that were started from "run" method should be
performed)
### How to reproduce
Create DAG file with Trino provider with this code and some CREATE Table hql
request.
```
...
th = TrinoHook()
@task(task_id="create_table")
def create_table(ds=None, **kwargs):
th.run("CREATE TABLE IF NOT EXISTS ...", handler=next_page)
cpt = create_table()
cpt
```
This code does not perform operation, but right POST request is sent to
trino server.
### Operating System
Kubuntu, 20.04.3 LTS
### Versions of Apache Airflow Providers
apache-airflow-providers-trino=2.0.1
### Deployment
Docker-Compose
### Deployment details
_No response_
### Anything else
I think it is needed to add support of handler for run method in provider
hook in file airflow/providers/trino/hooks/trino.py
In this case we get possibility to write handler, that can perform
fetchAll() on returned Cursor object, for example
Something like this:
```
def run(
self,
hql,
autocommit: bool = False,
parameters: Optional[dict] = None,
handler=None
) -> None:
"""Execute the statement against Trino. Can be used to create
views."""
return super().run(sql=self._strip_sql(hql), parameters=parameters,
handler=handler)
```
Because now code does not send handler to dbapi parent method
` return super().run(sql=self._strip_sql(hql), parameters=parameters)`
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]