Skip to content
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

Add connection url support to the client #228

Closed
PmegaOcalc opened this issue Feb 19, 2024 · 5 comments
Closed

Add connection url support to the client #228

PmegaOcalc opened this issue Feb 19, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@PmegaOcalc
Copy link

PmegaOcalc commented Feb 19, 2024

Use case

We set database environment variables based on the standard format of xxx://[userspec@][hostspec][/dbname][?paramspec]
Clickhouse js client currently doesn't support it and we need to specify the env variables inconsistently to other databases.

Describe the solution you'd like

Add support for connection string like clickhouse://[user_info@][hosts_and_ports][/dbname][?query_parameters]
as it is already supported in clickhouse ClickHouse/ClickHouse#50689

Additional context

ClickHouseClientConfigOptions defines the connection options

@slvrtrn
Copy link
Contributor

slvrtrn commented Feb 26, 2024

I will add URL support for http[s]://[username]:[password]@[host]:[port]/[database] in the next version and deprecate host (that was not the best name for it).

@slvrtrn
Copy link
Contributor

slvrtrn commented Feb 26, 2024

@PmegaOcalc, regarding [?query_parameters]/[?paramspec].

In the CLI client, it works like:

clickhouse-client clickhouse://localhost/my_database?s

# equivalent to:
clickhouse-client clickhouse://localhost/my_database -s

Would you expect CHJS to be (almost) entirely configurable via the URL, similar to the CLI?

@PmegaOcalc
Copy link
Author

yes, please

@slvrtrn
Copy link
Contributor

slvrtrn commented Mar 2, 2024

@PmegaOcalc, will be included in 1.0.0, ETA ~few weeks.

@slvrtrn
Copy link
Contributor

slvrtrn commented Apr 2, 2024

@PmegaOcalc, 1.0.0 is out; URL configuration is supported now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants