mz-sinks.td 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. $ set-sql-timeout duration=60s
  10. $ set-arg-default single-replica-cluster=quickstart
  11. # Verify that envelope types are correctly reported in mz_sinks
  12. > CREATE CONNECTION kafka_conn
  13. TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  14. > CREATE CONNECTION csr_conn TO CONFLUENT SCHEMA REGISTRY (
  15. URL '${testdrive.schema-registry-url}'
  16. );
  17. > CREATE TABLE mz_sinks_table (name string);
  18. > CREATE SINK mz_sinks_debezium
  19. IN CLUSTER ${arg.single-replica-cluster}
  20. FROM mz_sinks_table
  21. INTO KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-mz-sinks-debezium-${testdrive.seed}')
  22. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  23. ENVELOPE DEBEZIUM;
  24. > CREATE MATERIALIZED VIEW mz_sinks_table_keyed AS
  25. SELECT name, count(name) from mz_sinks_table
  26. GROUP BY name;
  27. > CREATE SINK mz_sinks_upsert
  28. IN CLUSTER ${arg.single-replica-cluster}
  29. FROM mz_sinks_table_keyed
  30. INTO KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-mz-upsert-debezium-${testdrive.seed}')
  31. KEY (name)
  32. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  33. ENVELOPE UPSERT;
  34. > SELECT envelope_type FROM mz_sinks WHERE name = 'mz_sinks_debezium'
  35. debezium
  36. > SELECT envelope_type FROM mz_sinks WHERE name = 'mz_sinks_upsert'
  37. upsert
  38. > SELECT format FROM mz_sinks WHERE name = 'mz_sinks_upsert'
  39. avro