Skip to content

Trino Client prompting for authentication at every Cursor created when using OAuth2Authentication #224

@IceS2

Description

@IceS2

Hello! I'm using the client to query Starburst.

I've been trying to understand how the Cache works for OAuth2Authentication since it's prompting for authentication at every cursor created.
I imagine it'd make sense to prompt for it at each connection created but not at every cursor, if not closing the previous opened connection.

I've got that error with the following code:

import trino

conn = trino.dbapi.connect(
            host=<HOST>,
            port=443,
            user=<USER>,
            http_scheme='https',
            auth=trino.auth.OAuth2Authentication()
        )

cur = conn.cursor()
cur.execute('SHOW CATALOGS')

cur = conn.cursor()
cur.execute('SHOW SCHEMAS IN hive')

image

If I reuse the same cursor this behavior doesn't happen and I don't need to authenticate multiple times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions