Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get infoUri before query finishes #388

Open
1 task
zyxue opened this issue Jul 5, 2023 · 2 comments
Open
1 task

How to get infoUri before query finishes #388

zyxue opened this issue Jul 5, 2023 · 2 comments

Comments

@zyxue
Copy link

zyxue commented Jul 5, 2023

Expected behavior

execute returns soon after it's run so that infoUri can be available for tracking.

Actual behavior

executes is blocked until at least one row is received or query is finished or cancelled (https://github.com/trinodb/trino-python-client/blob/0.326.0/trino/client.py#L819-L821)

Steps To Reproduce

from trino.dbapi import connect

conn = connect(
    host="<host>",
    port=<port>,
    user="<username>",
    catalog="<catalog>",
    schema="<schema>",
)
cur = conn.cursor()
result = cur.execute("SELECT * FROM system.runtime.nodes") # this used to return quickly, but not anymore.

Log output

No response

Operating System

NAME="Ubuntu" VERSION="20.04.4 LTS (Focal Fossa)"

Trino Python client version

0.319.0

Trino Server version

419

Python version

3.8.13

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@hashhar
Copy link
Member

hashhar commented Jul 21, 2023

What do you actually plan to do? Maybe there's an alternative.

We intentionally changed the behaviour to fix a bug where queries which don't return result sets silently swallowed errors. It has the side effect to make the client API easier to use since users no longer need to call fetch methods to actually start the query. See #220 and the release notes/CHANGES.md for that version.

@zyxue
Copy link
Author

zyxue commented Jul 21, 2023

Is it possible to expose a method that does the non-blocking stuff (esp. self._info_uri = status.info_uri) before the blocking while loop?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants