trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
9.88k stars 2.86k forks source link

Eagerly connect CLI to server when --external-authentication option is used #9441

Open findepi opened 2 years ago

findepi commented 2 years ago

When CLI is used with password- or kerberos-based auth, it doesn't need to actually make a connection on startup. CLI prints the prompt and authentication happens behind the scenes.

When --external-authentication, the user didn't provide authentication information yet. Printing prompt, and authenticating on first query isn't the best user experience possible.

$ bin/trino-cli --server https://..../ --user piotr@.... --external-authentication
trino> SHOW CATALOGS;
External authentication required. Please go to:
https://.......

Note that when --catalog and --schema are provided, the connection is made eagerly, already, but prints over the prompt:

$ bin/trino-cli --server https://..../ --user piotr@.... --external-authentication --catalog hive --schema default
trino:default> External authentication required. Please go to:
https://.......
kokosing commented 2 years ago

I think it is not only about external authentication. For example one would like to know that the password (or keytab) is invalid eagerly too.

kokosing commented 2 years ago

Oh... that would also verify if the server is up and running too.

findepi commented 2 years ago

@kokosing I agree that it would be better UX overall, but i also am aware the way CLI works was a conscious decision (even if i would make a different one). That's why I would want to focus on --external-authentication case only.

electrum commented 2 years ago

Yes, we should change this for everything, not just authentication.