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 https://github.com/mymarilyn/clickhouse-driver
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://try3.hydrolix.live:9440/sample?secure=True')
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 try3.hydrolix.live
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.
Updated 25 days ago
Did this page help you?