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
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -275,6 +275,16 @@ mysql_timezone: 'UTC' # optional, timezone for MySQL timestamp conversion (de
275
275
- `types_mappings`- custom types mapping, eg. you can map char(36) to UUID instead of String, etc.
276
276
- `ignore_deletes`- when set to `true`, DELETE operations in MySQL will be ignored during replication. This creates an append-only model where data is only added, never removed. In this mode, the replicator doesn't create a temporary database and instead replicates directly to the target database.
277
277
- `mysql_timezone`- timezone to use for MySQL timestamp conversion to ClickHouse DateTime64. Default is `'UTC'`. Accepts any valid timezone name (e.g., `'America/New_York'`, `'Europe/London'`, `'Asia/Tokyo'`). This setting ensures proper timezone handling when converting MySQL timestamp fields to ClickHouse DateTime64 with timezone information.
278
+
- `post_initial_replication_commands`- SQL commands to execute in ClickHouse after initial replication completes for each database. Useful for creating materialized views, summary tables, or other database objects. Commands are executed in order, once per database matching the pattern.
279
+
280
+
```yaml
281
+
post_initial_replication_commands:
282
+
- databases: '*'
283
+
commands:
284
+
- 'CREATE TABLE IF NOT EXISTS summary_table (...) ENGINE = SummingMergeTree() ORDER BY (...)'
285
+
- 'CREATE MATERIALIZED VIEW IF NOT EXISTS data_mv TO summary_table AS SELECT ...'
286
+
- 'INSERT INTO summary_table SELECT ... FROM replicated_table'
index: 'INDEX name_idx name TYPE ngrambf_v1(5, 65536, 4, 0) GRANULARITY 1'
31
+
32
+
http_host: 'localhost'
33
+
http_port: 9128
34
+
35
+
types_mapping:
36
+
'char(36)': 'UUID'
37
+
38
+
post_initial_replication_commands:
39
+
- databases: '*'
40
+
commands:
41
+
- 'CREATE TABLE IF NOT EXISTS events_per_day (event_date Date, event_type String, total_events UInt64) ENGINE = SummingMergeTree() ORDER BY (event_date, event_type)'
42
+
- 'CREATE MATERIALIZED VIEW IF NOT EXISTS events_mv TO events_per_day AS SELECT toDate(event_time) AS event_date, event_type, count() AS total_events FROM test_table GROUP BY event_date, event_type'
43
+
- 'INSERT INTO events_per_day SELECT toDate(event_time) AS event_date, event_type, count() AS total_events FROM test_table GROUP BY event_date, event_type'
0 commit comments