pg_cdc_capabilities.py 1.1 KB

123456789101112131415161718192021222324252627282930
  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.postgres_capabilities import PostgresTableExists
  10. from materialize.zippy.watermarked_object_capabilities import WatermarkedObjectExists
  11. from materialize.zippy.watermarks import Watermarks
  12. class PostgresCdcTableExists(WatermarkedObjectExists):
  13. """A Postgres CDC table exists in Materialize."""
  14. def __init__(
  15. self, name: str, postgres_table: PostgresTableExists | None = None
  16. ) -> None:
  17. self.name = name
  18. self.postgres_table = postgres_table
  19. def get_watermarks(self) -> Watermarks:
  20. assert self.postgres_table is not None
  21. return self.postgres_table.watermarks
  22. def get_name_for_query(self) -> str:
  23. return self.name