40-check-delete.td 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.delete_table_pk
  10. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  11. URL '${testdrive.schema-registry-url}'
  12. );
  13. > CREATE CONNECTION IF NOT EXISTS kafka_conn TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  14. > CREATE SOURCE delete_table_pk
  15. FROM KAFKA CONNECTION kafka_conn (TOPIC 'sql-server.test.dbo.delete_table_pk');
  16. > CREATE TABLE delete_table_pk_tbl FROM SOURCE delete_table_pk (REFERENCE "sql-server.test.dbo.delete_table_pk")
  17. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  18. ENVELOPE DEBEZIUM;
  19. # [btv] uncomment if we bring back classic debezium mode
  20. # $ schema-registry-wait topic=sql-server.dbo.delete_table_nopk
  21. # > CREATE SOURCE delete_table_nopk
  22. # FROM KAFKA CONNECTION kafka_conn (TOPIC 'sql-server.dbo.delete_table_nopk');
  23. # > CREATE TABLE delete_table_nopk_tbl FROM SOURCE delete_table_nopk (REFERENCE "sql-server.dbo.delete_table_nopk")
  24. # FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  25. # ENVELOPE DEBEZIUM;
  26. $ sql-server-connect name=sql-server
  27. server=tcp:sql-server,1433;IntegratedSecurity=true;TrustServerCertificate=true;User ID=sa;Password=${arg.sa-password}
  28. $ sql-server-execute name=sql-server
  29. USE test;
  30. DELETE FROM delete_table_pk WHERE key_col = 'key1';
  31. # DELETE FROM delete_table_nopk WHERE key_col = 'key2';
  32. > SELECT * FROM delete_table_pk_tbl;
  33. key2 value2
  34. # > SELECT * FROM delete_table_nopk_tbl;
  35. # key1 value1