The connector gets a token with the client-credentials grant, caches it, and refreshes it shortly before it expires. OAuth doesn’t turn on TLS for you, so set secure=True.
Cursor API
cursor = conn.cursor(catalog_name="<catalog>")query_id = cursor.execute("SELECT * FROM <table>")rows = cursor.fetchall()
Method
What it does
conn.cursor(catalog_name=...)
Opens a cursor scoped to a catalog.
cursor.execute(query)
Runs a statement and returns its query ID.
cursor.fetchall()
Returns all rows.
cursor.fetchone()
Returns one row.
cursor.fetchmany(n)
Returns up to n rows.
cursor.fetchall_buffer()
Returns a generator that streams rows, to keep memory low on large results.
cursor.explain_analyse()
Returns the execution plan and statistics after a query runs.
cursor.cancel(query_id)
Aborts a running query.
cursor.clear()
Frees cached results. Not needed after aborting a query.