Skip to content

Commit 5e1a501

Browse files
authored
DOC-996 Add schema_evolution.processors (#173)
1 parent 3bfe5ed commit 5e1a501

File tree

2 files changed

+18
-38
lines changed

2 files changed

+18
-38
lines changed

modules/components/pages/inputs/redpanda_migrator.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ input:
5858
topics: [] # No default (required)
5959
regexp_topics: false
6060
rack_id: "" # No default (optional)
61-
instance_id "" # No default (optional)
61+
instance_id: "" # No default (optional)
6262
rebalance_timeout: 45s
6363
session_timeout: 1m
6464
heartbeat_interval: 3s

modules/components/pages/outputs/snowflake_streaming.adoc

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,12 @@ output:
3838
CREATE TABLE IF NOT EXISTS mytable (amount NUMBER);
3939
schema_evolution:
4040
enabled: false # No default (required)
41-
new_column_type_mapping: |-
42-
root = match this.value.type() {
43-
this == "string" => "STRING"
44-
this == "bytes" => "BINARY"
45-
this == "number" => "DOUBLE"
46-
this == "bool" => "BOOLEAN"
47-
this == "timestamp" => "TIMESTAMP"
48-
_ => "VARIANT"
41+
processors: [] # No default (optional)
4942
batching:
5043
count: 0
5144
byte_size: 0
52-
period: ""
53-
check: ""
45+
period: "" # No default (optional)
46+
check: "" # No default (optional)
5447
max_in_flight: 4
5548
```
5649
@@ -78,23 +71,15 @@ output:
7871
CREATE TABLE IF NOT EXISTS mytable (amount NUMBER);
7972
schema_evolution:
8073
enabled: false # No default (required)
81-
new_column_type_mapping: |-
82-
root = match this.value.type() {
83-
this == "string" => "STRING"
84-
this == "bytes" => "BINARY"
85-
this == "number" => "DOUBLE"
86-
this == "bool" => "BOOLEAN"
87-
this == "timestamp" => "TIMESTAMP"
88-
_ => "VARIANT"
89-
}
74+
processors: [] # No default (optional)
9075
build_options:
9176
parallelism: 1
9277
chunk_size: 50000
9378
batching:
9479
count: 0
9580
byte_size: 0
96-
period: ""
97-
check: ""
81+
period: "" # No default (optional)
82+
check: "" # No default (optional)
9883
processors: [] # No default (optional)
9984
max_in_flight: 4
10085
channel_prefix: channel-${HOST} # No default (optional)
@@ -327,28 +312,23 @@ Whether schema evolution is enabled. When set to `true`, the Snowflake table is
327312

328313
*Type*: `bool`
329314

330-
=== `schema_evolution.new_column_type_mapping`
315+
=== `schema_evolution.processors`
331316

332-
A mapping function from the Redpanda Connect data types to column data types in Snowflake. This mapping should result in the assignment of a string to the `root` variable with the data type for the new column in Snowflake.
317+
A series of processors to execute when new columns are added to the Snowflake table. You can use these processors to:
333318

334-
The input to this mapping is an object with the value and the name of the new column. For example: `{"value": 42.3, "name":"new_data_field"}"`.
319+
- Run side effects when the schema evolves.
320+
- Enrich the message with additional information to guide the schema changes.
335321

336-
You can also override the mapping function to customize data types.
322+
For example, a processor could read the schema from the schema registry that a message was produced with and use that schema to determine the data type of the new column in Snowflake.
337323

338-
*Type*: `string`
324+
The input to these processors is an object with the value and name of the new column, the original message, and details of the Snowflake table the output writes to.
339325

340-
*Default*:
326+
For example: `{"value": 42.3, "name":"new_data_field", "message": {"existing_data_field": 42, "new_data_field": "db_field_name"}, "db": MY_DATABASE", "schema": "MY_SCHEMA", "table": "MY_TABLE"}`
327+
328+
The output from the processors must be a valid message, which contains a string that specifies the column type for the new column in Snowflake. The metadata remains the same as in the original message that triggered the schema update.
329+
330+
*Type*: `array`
341331

342-
```yml
343-
root = match this.value.type() {
344-
this == "string" => "STRING"
345-
this == "bytes" => "BINARY"
346-
this == "number" => "DOUBLE"
347-
this == "bool" => "BOOLEAN"
348-
this == "timestamp" => "TIMESTAMP"
349-
_ => "VARIANT"
350-
}
351-
```
352332

353333
=== `build_options`
354334

0 commit comments

Comments
 (0)