Skip to content

Client defaults to port 8080 with HTTPs scheme #539

Closed
@nfantone

Description

@nfantone

Expected behavior

Thanks to this default argument, not explicitly setting a port ends in a connection timeout with an https connection URI.

Given how both DEFAULT_PORT and DEFAULT_TLS_PORT constants exist, the default value of the connection port should likely be dependant on the scheme.

Actual behavior

Compare this with the behaviour of the Node trino-client implementation.

  • trino-client (JS)
import { BasicAuth, Trino } from "trino-client";

const trino = Trino.create({
  server: "https://my.endpoint.com", // No explicit port
  catalog: "gp_eu",
  schema: "dbo",
  auth: new BasicAuth("user", "xxxxxx"),
});

async function main() {
  const iter = await trino.query("SHOW TABLES FROM gp_eu.dbo");

  for await (const queryResult of iter) {
    console.log(queryResult.data);
    console.error(queryResult.error);
  }
}

main(); // Prints query results
  • trino (Python)
from trino.auth import BasicAuthentication
from trino.dbapi import connect

def main():
  conn = connect(
    host="https://my.endpoint.com",
    auth=BasicAuthentication("user",  "xxxxxx"),
    catalog="gp_eu",
    schema="dbo",
    http_scheme="https"
  )
  cur = conn.cursor()
  cur.execute("SHOW TABLES FROM gp_eu.dbo")
  rows = cur.fetchall()

  for row in rows:
    print(row)

if __name__ == "__main__":
    main() # Raises urllib3.exceptions.ConnectionTimeout

Steps To Reproduce

See above.

Log output

No response

Operating System

macOS 15.3.2

Trino Python client version

0.333.0

Trino Server version

470

Python version

3.12

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

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