Learn about importing the clickhouse-driver integration and how it captures queries from clickhouse-driver as breadcrumbs.

The clickhouse-driver integration captures queries from clickhouse-driver as breadcrumbs and spans. The integration is available for clickhouse-driver 0.2.0 or later.

Install sentry-sdk with the clickhouse-driver extra.

pip install --upgrade 'sentry-sdk[clickhouse-driver]'

If you have the clickhouse-driver package in your dependencies, the clickhouse-driver integration will be enabled automatically when you initialize the Sentry SDK.

Configuration should happen as early as possible in your application's lifecycle.

import sentry_sdk

    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for tracing.
    # Set profiles_sample_rate to 1.0 to profile 100%
    # of sampled transactions.
    # We recommend adjusting this value in production.

By default, the parameters of the query are not retrieved. To see the query parameters in Sentry, enable send_default_pii. See Basic Options for details.

from clickhouse_driver import Client

def main():
    sentry_init(...)  # same as above

    with sentry_sdk.start_transaction(name="testing_sentry"):
        client = Client(host=DATABASE_HOST)
        client.execute("DROP TABLE IF EXISTS sentry_test")
        client.execute("CREATE TABLE sentry_test (x Int32) ENGINE = Memory")
        client.execute("INSERT INTO sentry_test (x) VALUES", [{"x": 100}])


This will create a transaction called testing_sentry in the Performance section of, and create spans for the database operations.

It takes a couple of moments for the data to appear in

  • clickhouse-driver >= 0.2.0
  • python >= 3.8
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").