40-check-transactions.td 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. $ schema-registry-wait topic=sql-server.test.dbo.transaction_table1
  10. > CREATE CONNECTION IF NOT EXISTS kafka_conn TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  11. > CREATE SOURCE transaction_table1
  12. FROM KAFKA CONNECTION kafka_conn (TOPIC 'sql-server.test.dbo.transaction_table1');
  13. > CREATE TABLE transaction_table1_tbl FROM SOURCE transaction_table1 (REFERENCE "sql-server.test.dbo.transaction_table1")
  14. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  15. ENVELOPE DEBEZIUM;
  16. $ schema-registry-wait topic=sql-server.test.dbo.transaction_table2
  17. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  18. URL '${testdrive.schema-registry-url}'
  19. );
  20. > CREATE SOURCE transaction_table2
  21. FROM KAFKA CONNECTION kafka_conn (TOPIC 'sql-server.test.dbo.transaction_table2');
  22. > CREATE TABLE transaction_table2_tbl FROM SOURCE transaction_table2 (REFERENCE "sql-server.test.dbo.transaction_table2")
  23. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  24. ENVELOPE DEBEZIUM;
  25. $ sql-server-connect name=sql-server
  26. server=tcp:sql-server,1433;IntegratedSecurity=true;TrustServerCertificate=true;User ID=sa;Password=${arg.sa-password}
  27. $ sql-server-execute name=sql-server
  28. USE test;
  29. BEGIN TRANSACTION INSERT INTO transaction_table1 VALUES ('t1-trans3-event1'); INSERT INTO transaction_table2 VALUES ('t2-trans3-event1'); INSERT INTO transaction_table1 VALUES ('t1-trans3-event2'); INSERT INTO transaction_table2 VALUES ('t2-trans3-event2'); COMMIT;
  30. BEGIN TRANSACTION INSERT INTO transaction_table1 VALUES ('t1-trans4-event1'); INSERT INTO transaction_table2 VALUES ('t2-trans4-event1'); INSERT INTO transaction_table1 VALUES ('t1-trans4-event2'); INSERT INTO transaction_table2 VALUES ('t2-trans4-event2'); COMMIT;
  31. > SELECT * FROM transaction_table1_tbl
  32. t1-trans1-event1
  33. t1-trans1-event2
  34. t1-trans2-event1
  35. t1-trans2-event2
  36. t1-trans3-event1
  37. t1-trans3-event2
  38. t1-trans4-event1
  39. t1-trans4-event2
  40. > SELECT * FROM transaction_table2_tbl
  41. t2-trans1-event1
  42. t2-trans1-event2
  43. t2-trans2-event1
  44. t2-trans2-event2
  45. t2-trans3-event1
  46. t2-trans3-event2
  47. t2-trans4-event1
  48. t2-trans4-event2