mzcompose.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. """
  10. Connect Postgres/SQL Server/MySQL to Materialize using Kafka+Debezium
  11. """
  12. from materialize.mzcompose.composition import Composition
  13. from materialize.mzcompose.services.debezium import Debezium
  14. from materialize.mzcompose.services.kafka import Kafka
  15. from materialize.mzcompose.services.materialized import Materialized
  16. from materialize.mzcompose.services.mysql import MySql
  17. from materialize.mzcompose.services.mz import Mz
  18. from materialize.mzcompose.services.postgres import Postgres
  19. from materialize.mzcompose.services.schema_registry import SchemaRegistry
  20. from materialize.mzcompose.services.sql_server import SqlServer
  21. from materialize.mzcompose.services.testdrive import Testdrive
  22. from materialize.mzcompose.services.zookeeper import Zookeeper
  23. prerequisites = ["zookeeper", "kafka", "schema-registry", "debezium", "materialized"]
  24. SERVICES = [
  25. Zookeeper(),
  26. Kafka(auto_create_topics=True),
  27. SchemaRegistry(),
  28. Debezium(),
  29. Mz(app_password=""),
  30. Materialized(),
  31. Postgres(),
  32. SqlServer(),
  33. MySql(),
  34. Testdrive(no_reset=True, default_timeout="300s"),
  35. ]
  36. def workflow_default(c: Composition) -> None:
  37. def process(name: str) -> None:
  38. if name == "default":
  39. return
  40. with c.test_case(name):
  41. c.workflow(name)
  42. c.test_parts(list(c.workflows.keys()), process)
  43. def workflow_postgres(c: Composition) -> None:
  44. c.up(*prerequisites, "postgres")
  45. c.run_testdrive_files("postgres/debezium-postgres.td.initialize")
  46. c.run_testdrive_files("postgres/*.td")
  47. def workflow_sql_server(c: Composition) -> None:
  48. c.up(*prerequisites, "sql-server")
  49. c.run_testdrive_files(
  50. f"--var=sa-password={SqlServer.DEFAULT_SA_PASSWORD}",
  51. "sql-server/*.td",
  52. )
  53. def workflow_mysql(c: Composition) -> None:
  54. c.up(*prerequisites, "mysql")
  55. c.run_testdrive_files(
  56. f"--var=mysql-root-password={MySql.DEFAULT_ROOT_PASSWORD}",
  57. "mysql/*.td",
  58. )