create-in-v0.27.0-kafka-source.td 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. # The linked cluster for the source will be created by the mz_system user
  10. # when upgrading to v0.39.
  11. > CREATE TABLE IF NOT EXISTS linked_cluster_audit_event_user (priority int, user text)
  12. > INSERT INTO linked_cluster_audit_event_user VALUES (27, 'mz_system')
  13. $ set schema={
  14. "type": "record",
  15. "name": "cpx",
  16. "fields": [
  17. {"name": "a", "type": "long"},
  18. {"name": "b", "type": "long"}
  19. ]
  20. }
  21. $ kafka-create-topic topic=upgrade-kafka-source-${arg.upgrade-from-version}
  22. $ kafka-ingest format=avro topic=upgrade-kafka-source-${arg.upgrade-from-version} schema=${schema} timestamp=1
  23. {"a": 1, "b": 2}
  24. {"a": 2, "b": 3}
  25. >[version>=7800] CREATE CONNECTION IF NOT EXISTS kafka_conn TO KAFKA (
  26. BROKER '${testdrive.kafka-addr}',
  27. SECURITY PROTOCOL PLAINTEXT
  28. )
  29. >[version<7800] CREATE CONNECTION IF NOT EXISTS kafka_conn TO KAFKA (
  30. BROKER '${testdrive.kafka-addr}'
  31. )
  32. > CREATE SOURCE kafka_source
  33. FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-upgrade-kafka-source-${arg.upgrade-from-version}-${testdrive.seed}')
  34. FORMAT AVRO USING SCHEMA '${schema}'
  35. ENVELOPE NONE
  36. > SELECT COUNT(*) FROM kafka_source
  37. 2