Creating tables
Create Data Pools via the API or Terraform.
Propel Data Pools are ClickHouse tables with a pipeline to ingest data from a data source. With the API, you can create an empty Data Pool that creates table in Propel’s Serverless ClickHouse.
See the Create Data Pool API reference documentation.
API Arguments
The table below describes the input parameters for the createDataPoolV2
API.
Argument | Description | Required |
---|---|---|
uniqueName | The Data Pool’s unique name. If not specified, Propel will set the ID as the unique name. | No |
description | The Data Pool’s description. | No |
timestamp | The table’s default timestamp column. Used as the default timestamp for the Query APIs. | No |
columns | The list of column names and their types. | Yes |
accessControlEnabled | Enables or disables access control for the Data Pool. If the Data Pool has access control enabled, Applications must be assigned Data Pool Access Policies in order to query the Data Pool and its Metrics. | No |
tableSettingsInput | The tableSettingsInput object define how the Data Pool’s table is created in ClickHouse. See table settings below. | No |
Table settings
The table settings define how the table is created in ClickHouse. To learn more about table engines, read our guide on How to select a table engine and sorting key.
Creating tables with TTL
You can configure Time-To-Live (TTL) settings for your Data Pool to automatically manage data lifecycle. TTL allows you to:
- Delete old data after a specified time interval
- Roll up aging data into aggregations before deletion
TTL syntax
Example TTL expressions
A table that deletes data after 12 months:
A table that deletes data after 12 months where event type is error
:
A table that deletes data after 12 months and rolls up data into a count and sum aggregations:
Some notes on the TTL expression:
- The TTL clause must be a prefix of the primary key. Therefore, you need to add
toStartOfDay(created_at)
to the sorting key. - Your Data Pool needs to have the columns
event_count
andsum_quantity
to store the aggregated results. - You need to set the following default column values for the aggregations to work:
event_count
to1
sum_quantity
toquantity
See the example on how to create a table with TTL in the Console and API.
Examples
Example 1: Create a MergeTree table
This example shows how to create a Data Pool using the API and Terraform.
Example 2: A table that deletes data after 12 months
In the “Table settings” step of the Data Pool creation wizard, click “Advanced”, and you can set the TTL for your Data Pool.
Was this page helpful?