debezium_capabilities.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. from materialize.zippy.framework import Capability
  10. from materialize.zippy.postgres_capabilities import PostgresTableExists
  11. from materialize.zippy.watermarked_object_capabilities import WatermarkedObjectExists
  12. from materialize.zippy.watermarks import Watermarks
  13. class DebeziumRunning(Capability):
  14. """Debezium is running in the environment."""
  15. pass
  16. class DebeziumSourceExists(WatermarkedObjectExists):
  17. """A Debezium source exists in Materialize."""
  18. def __init__(
  19. self, name: str, postgres_table: PostgresTableExists | None = None
  20. ) -> None:
  21. self.name = name
  22. self.postgres_table = postgres_table
  23. def get_watermarks(self) -> Watermarks:
  24. assert self.postgres_table is not None
  25. return self.postgres_table.watermarks
  26. def get_name_for_query(self) -> str:
  27. return f"{self.name}_tbl"