Hydrolix uses the Clickhouse SQL engine, so you can connect to Hydrolix using any of several different Python libraries that support Clickhouse servers. This example uses clickhouse-driver.
To install clickhouse-driver, run the following command:
fromclickhouse_driverimportClient## Always include settings, it contains some breakers to prevent query the world scenariosettings={'hdx_query_max_timerange_sec':604800,'hdx_query_max_execution_time':60}## don't forget to url encode username and password. You can use native tcp port 9440 or http 8088client=Client.from_url('clickhouse://username:password@<your host name>:9440/sample_project?secure=true')count=client.execute('select count() from my_project.my_logs where timestamp >= now() - INTERVAL 60 MINUTE',settings=settings)print(count)
Don't forget to replace the hostname with your own Hydrolix cluster's hostname!