15-expose-progress.td 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. # Setup SQL Server state.
  10. #
  11. # Create a table that has CDC enabled.
  12. $ sql-server-connect name=sql-server
  13. server=tcp:sql-server,1433;IntegratedSecurity=true;TrustServerCertificate=true;User ID=${arg.default-sql-server-user};Password=${arg.default-sql-server-password}
  14. $ sql-server-execute name=sql-server
  15. DROP DATABASE IF EXISTS test_15;
  16. CREATE DATABASE test_15;
  17. USE test_15;
  18. EXEC sys.sp_cdc_enable_db;
  19. ALTER DATABASE test_15 SET ALLOW_SNAPSHOT_ISOLATION ON;
  20. CREATE TABLE t15_pk (key_col VARCHAR(20) PRIMARY KEY, val_col VARCHAR(1024));
  21. EXEC sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name = 't15_pk', @role_name = 'SA', @supports_net_changes = 0;
  22. INSERT INTO t15_pk VALUES ('a', 'hello world'), ('b', 'foobar'), ('c', 'anotha one');
  23. # Exercise Materialize.
  24. > CREATE SECRET IF NOT EXISTS sql_server_pass AS '${arg.default-sql-server-password}'
  25. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  26. ALTER SYSTEM SET enable_sql_server_source = true;
  27. > CREATE CONNECTION sql_server_test_15_connection TO SQL SERVER (
  28. HOST 'sql-server',
  29. PORT 1433,
  30. DATABASE test_15,
  31. USER '${arg.default-sql-server-user}',
  32. PASSWORD = SECRET sql_server_pass
  33. );
  34. # Create a SQL Server Source.
  35. > CREATE SOURCE t15_pk_sql_server
  36. FROM SQL SERVER CONNECTION sql_server_test_15_connection
  37. FOR ALL TABLES
  38. EXPOSE PROGRESS AS t15_renamed_progress_relation;
  39. > SELECT name FROM mz_sources WHERE name LIKE 't15%';
  40. t15_pk
  41. t15_pk_sql_server
  42. t15_renamed_progress_relation
  43. > SHOW COLUMNS FROM t15_renamed_progress_relation;
  44. lsn true bytea ""