Skip to content

Client defaults to port 8080 with HTTPs scheme #539

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

Open
1 task done
nfantone opened this issue Mar 13, 2025 · 2 comments
Open
1 task done

Client defaults to port 8080 with HTTPs scheme #539

nfantone opened this issue Mar 13, 2025 · 2 comments

Comments

@nfantone
Copy link

nfantone commented Mar 13, 2025

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!
@hashhar
Copy link
Member

hashhar commented Apr 10, 2025

@nfantone Are you still working to send a PR or should someone else take this over?

I agree with the change you are proposing.

@nfantone
Copy link
Author

nfantone commented Apr 13, 2025

@hashhar Sure. Here you are: #549

I just thought, since there was no reply, there wasn't much interest on this. Already signed and sent the CLA.

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

2 participants