You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,6 +97,22 @@ To start using ClickHouse-Schema in your projects, follow these steps:
97
97
- Use `<your_schema>.GetOptions()` to access the options passed when creating the table schema.
98
98
- Use `<your_schema>.GetCreateTableQueryAsList()` to get the `CREATETABLE` query as a list of strings, which can be helpful for debugging or logging.
99
99
100
+
## Schema Options
101
+
102
+
When creating a schema, you can provide the following options:
103
+
104
+
- **`table_name`** (required): The name of the table in ClickHouse
105
+
- **`primary_key`** (optional): The primary key for the table. If not specified, `order_by` must be specified
106
+
- **`order_by`** (optional): The ORDER BY clause for the table. If not specified, `primary_key` must be specified
107
+
- **`database`** (optional): The database to use for the table
108
+
- **`on_cluster`** (optional): The name of the cluster to use for the table
109
+
- **`engine`** (optional): The engine to use for the table, default is `MergeTree()`
110
+
- **`partition_by`** (optional): The partition expression for the table. Can be any valid ClickHouse expression:
111
+
- Single expression: `"toYYYYMM(visitDate)"` or `"visitDate"`
112
+
- Tuple of expressions: `"(toMonday(startDate), eventType)"`
113
+
- Complex expressions: `"sipHash64(userId) % 16"`
114
+
- **`additional_options`** (optional): An array of strings that are appended to the end of the CREATE TABLE query (e.g., `['COMMENT \'Table comment\'']`)
* ChSchemaOptions is used to define the options for a clickhouse table schema.
17
9
*
@@ -21,15 +13,17 @@ export type ChSchemaDefinition = Record<string, SchemaValue>
21
13
* @param primary_key is the primary key for the table. if not specified, order_by must be specified
22
14
* @param order_by is the order by clause for the table. if not specified, primary_key must be specified
23
15
* @param engine is the engine to use for the table, default is MergeTree()
16
+
* @param partition_by is the partition expression for the table. Can be any valid ClickHouse expression (e.g., "toYYYYMM(date_column)", "(toMonday(StartDate), EventType)", "sipHash64(userId) % 16")
24
17
* @param additional_options is an string array of options that are appended to the end of the create table query
0 commit comments