Skip to content

Python Trino quickstart: demonstrate ADBC-specific features (e.g., last_query_id) #113

Description

@prabhacloud

The Python Trino quickstart (python/trino/main.py) demonstrates the minimum viable connect+execute+fetch flow. Reading through the ADBC Trino driver docs at https://docs.adbc-drivers.org/drivers/trino/index.html, I noticed one feature that's interesting for a quickstart because it's ADBC-specific (i.e., users can't learn it from Trino JDBC or Go-client docs):

  • trino.statement.last_query_id — a read-only statement option that returns the Trino query ID of the most recently executed statement. Useful for observability ("paste this into Trino's UI to find your query"). Demonstrates the cursor.adbc_statement / option-getter surface, which is otherwise invisible in a simple quickstart.

Proposed change (small):

cursor.execute("SELECT nationkey, name, regionkey FROM tpch.tiny.nation LIMIT 5")
print("Trino query ID:", cursor.adbc_statement.get_option("trino.statement.last_query_id"))
table = cursor.fetch_arrow_table()

Optionally I could also add a "Common connection options" section to the README documenting SSL, SSLVerification, session_properties, and source — the four URI query params listed in the driver docs — with short example URIs. Happy to keep main.py minimal and put extras in the README only, or include both in one PR. Or keep this scope tighter — let me know which you prefer.

Before I open a PR, two questions:

  1. Is this in scope for what you want these quickstarts to demonstrate? The repo README pitches them as "minimal but well-documented," so I want to confirm before expanding.
  2. Are there other ADBC-specific things you'd want surfaced in the Python Trino quickstart that I'm missing? (I don't have visibility into the ADBC Trino driver's source repo to enumerate options beyond what's on docs.adbc-drivers.org.)

Unrelated heads-up: the example URI on https://docs.adbc-drivers.org/drivers/trino/index.html has the same catalog=tcph typo we just fixed in this repo (#112). Probably worth patching wherever that page is sourced from — not asking for action here, just flagging.

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