diff --git a/tap_postgres/client.py b/tap_postgres/client.py index cc159cc6..d7178db2 100644 --- a/tap_postgres/client.py +++ b/tap_postgres/client.py @@ -207,6 +207,13 @@ class PostgresStream(SQLStream): # JSONB Objects won't be selected without type_conformance_level to ROOT_ONLY TYPE_CONFORMANCE_LEVEL = TypeConformanceLevel.ROOT_ONLY + @functools.cached_property + def schema(self) -> dict: + """Override schema adding _sdc columns.""" + schema_dict = self._singer_catalog_entry.schema.to_dict() + schema_dict["properties"]["_sdc_postgres_schema"] = {"type": ["string", "null"]} + return schema_dict + def max_record_count(self) -> int | None: """Return the maximum number of records to fetch in a single query.""" return self.config.get("max_record_count") @@ -280,6 +287,7 @@ def get_records(self, context: Context | None) -> t.Iterable[dict[str, t.Any]]: if transformed_record is None: # Record filtered out during post_process() continue + transformed_record["_sdc_postgres_schema"] = table.schema yield transformed_record