via Python Library

How to use Clickhouse Python library with Hydrolix

There are several python library useful to connect to a Clickhouse server, in this example I'm leveraging the following
The documentation is available here

Here's a quick example on how to connect to Hydrolix using python:

pip3 install clickhouse-driver
from clickhouse_driver import Client
client = Client.from_url('clickhouse://')
client.execute('SELECT COUNT() FROM sample.performance_logs')

This will import the clickhouse driver into your application, you can then provide a URL to connect in this example we are using our demo server
By default the clickhouse native port over TLS is 9440, you have to then specify the secure=True to ensure that the connection will be over TLS.
And finally you can execute a query.

Did this page help you?