Clickhouse
How to configure your ClickHouse database
Install
Run the following command to install the connector from the root of your project:
How to configure sources
The sources files must be inside the queries/
folder.
To know how the source hierarchy works, please, visit How to configure sources.
Configuration
To configure the connection with your ClickHouse database follow these steps:
Create the source `.yaml` file within the `queries` folder if you haven't already
/queries/source.yml
Add the following code for your ClickHouse connection
Replace the details section with your info and save
Done, now you can test your connection
Attributes
Usually, you may only need to set the url
, username
, password
, and database
attributes. However, for more advanced configurations, here’s the list of all available attributes:
- url → The URL of your ClickHouse instance. Example:
https://latitude.server.aws.clickhouse.cloud:8443
- pathname → An optional pathname to add to the ClickHouse URL after it is parsed by the client. Default value:
''
. - request_timeout → The request timeout in milliseconds. Default value:
30_000
. - username → The name of the user on whose behalf requests are made. Default value:
default
. - password → The user password. Default value:
''
. - database → The name of the database to connect to. Default value:
default
. - session_id → An optional ClickHouse Session ID to send with every request.
- clickhouse_settings → An additional dictionary of settings to pass to the ClickHouse client. Check out the official ClickHouse API docs for more information about it. Default value:
{}
. - tls → An optional dictionary of TLS settings. Default value:
{}
.- ca_cert → The path to the CA certificate file.
- cert → The path to the client certificate file.
- key → The path to the client key file.
Test connection
To test the connection you can:
- Create a query
.sql
in thequeries
directory that points to a table of your new connection in theFROM
clause. See the section SQL Syntax Basics to learn more. - Use the command line to run
latitude run query_file_name
wherequery_file_name
is the name of your.sql
file. This will display the results in your terminal. See the section Running queries to learn more about how to query your data.