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

Having no keyring backends should be treated as no keyring module and fall back to using memory-based cache #431

Closed
1 task done
gerilya opened this issue Dec 19, 2023 · 3 comments

Comments

@gerilya
Copy link

gerilya commented Dec 19, 2023

Expected behavior

If an attempt to load keyring module fails, there is a fall back to _OAuth2TokenInMemoryCache.
I think no backends or having keyring.backends.null.Keyring backend should be treated the same way.
Using keyring.backends.null.Keyring backend is the recommended way to disable keyring. See Disabling Keyring at https://pypi.org/project/keyring/

Actual behavior

When there is keyring package installed but there are no available backends, the following error is generated:

Although keyring module is installed no backend has been detected, check https://pypi.org/project/keyring/ for more information.

Steps To Reproduce

Run the following code on Sagemaker notebook instance:

import trino

connect = trino.dbapi.connect(
                              host=config['HOST'],
                              port=config['PORT'],
                              http_scheme=config['PROTOCOL'],
                              auth=trino.auth.OAuth2Authentication(),
                              user=config['USERNAME'],
                              )
cursor=connect.cursor()
query="some query"
cursor.execute(query)

Log output

[ 2023-12-14T09:53:41.370244 | Although keyring module is installed no backend has been detected, check https://pypi.org/project/keyring/ for more information. ]

Operating System

AWS Sagemaker Notebook

Trino Python client version

0.327.0

Trino Server version

can't connect - not relevant

Python version

Python 3.10.13

Are you willing to submit PR?

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

hashhar commented Feb 16, 2024

@hovaesco can this be closed after #435?

@hovaesco
Copy link
Member

@hashhar Yes.

@hovaesco
Copy link
Member

Resolved by #435

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

3 participants