ClickHouse
Collect and forward analytics events to your ClickHouse tables.
Find it on GitHub: /edgee-cloud/clickhouse-component
ClickHouse is an open-source columnar database that allows you to generate analytical reports using SQL queries in real-time.
Event Mapping
Here’s how Edgee events map to ClickHouse records:
Edgee Event | ClickHouse record | Description |
---|---|---|
Page | A new record in the configured table | Full JSON dump of the Page event |
Track | A new record in the configured table | Full JSON dump of the Track event |
User | A new record in the configured table | Full JSON dump of the User event |
Getting Started
To integrate ClickHouse into your Edgee project:
- Open the Edgee console and navigate to your project’s Components.
- Select “Add a component” and choose
edgee/clickhouse
from the list of available components. - Enter your ClickHouse configuration and credentials, and click Save.
- Create a new table in ClickHouse with the correct schema (see next section).
- Once the component has been configured, you are ready to send new records to ClickHouse.
Creating the ClickHouse Table
Before ingesting events, you’ll ned to create a new table with the following schema, depending on your ClickHouse version and JSON
support:
JSON fields
New records are ingested individually using JSONEachRow
.
If your ClickHouse version supports JSON
or Object('json')
types, both context
and data
will contain additional JSON sub-fields, whose schema is automatically inferred at runtime.
Please note that:
- The sub-fields under
context
are always the same, so you can use queries such asSELECT context.client.ip AS ip FROM edgee
- The sub-fields under
data
depend on the value ofevent_type
, so you can use queries such as:SELECT data.Track.name FROM edgee WHERE event_type = 'Track'
SELECT data.Page.path FROM edgee WHERE event_type = 'Page'
Component Name
When configuring the component in your Edgee Data Layer or within SDK calls, use edgee/clickhouse
as the component name:
For more details on ClickHouse implementation, refer to the official ClickHouse HTTP API documentation.