123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- # Copyright Materialize, Inc. and contributors. All rights reserved.
- #
- # Use of this software is governed by the Business Source License
- # included in the LICENSE file at the root of this repository.
- #
- # As of the Change Date specified in that file, in accordance with
- # the Business Source License, use of this software will be governed
- # by the Apache License, Version 2.0.
- $ set keyschema={
- "type": "record",
- "name": "Key",
- "fields": [
- {"name": "key", "type": "string"}
- ]
- }
- $ set schema={
- "type" : "record",
- "name" : "test",
- "fields" : [
- {"name":"f1", "type":"string"},
- {"name":"f2", "type":"long"}
- ]
- }
- $ kafka-create-topic topic=upsert
- $ kafka-ingest format=avro topic=upsert key-format=avro key-schema=${keyschema} schema=${schema}
- {"key": "fish"} {"f1": "MUCHMUCHMUCHLONGERVALUE", "f2": 1}
- > CREATE CONNECTION conn
- FOR KAFKA BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT
- > CREATE CONNECTION c_conn
- FOR CONFLUENT SCHEMA REGISTRY URL '${testdrive.schema-registry-url}'
- > CREATE CLUSTER upsert_cluster SIZE '1';
- > CREATE SOURCE upsert
- IN CLUSTER upsert_cluster
- FROM KAFKA CONNECTION conn (TOPIC
- 'testdrive-upsert-${testdrive.seed}'
- )
- > CREATE TABLE upsert_tbl FROM SOURCE upsert (REFERENCE "testdrive-upsert-${testdrive.seed}")
- FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION c_conn
- ENVELOPE UPSERT
- > SELECT f2 from upsert_tbl
- 1
- $ kafka-ingest format=avro topic=upsert key-format=avro key-schema=${keyschema} schema=${schema}
- {"key": "fish"} {"f1": "s", "f2": 2}
- > SELECT f2 from upsert_tbl
- 2
|