Skip to content

Commit

Permalink
fix: Expose add_record_metadata as a builtin target setting
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jul 27, 2023
1 parent 619d68b commit 0fc6b51
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions singer_sdk/helpers/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@
description="The default target database schema name to use for all streams.",
),
).to_dict()
ADD_RECORD_METADATA_CONFIG = PropertiesList(
Property(
"add_record_metadata",
BooleanType(),
description="Add metadata to records.",
),
).to_dict()


class DeprecatedEnum(Enum):
Expand Down
3 changes: 3 additions & 0 deletions singer_sdk/target_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from singer_sdk.helpers._classproperty import classproperty
from singer_sdk.helpers._compat import final
from singer_sdk.helpers.capabilities import (
ADD_RECORD_METADATA_CONFIG,
BATCH_CONFIG,
TARGET_SCHEMA_CONFIG,
CapabilitiesEnum,
Expand Down Expand Up @@ -594,6 +595,8 @@ def _merge_missing(source_jsonschema: dict, target_jsonschema: dict) -> None:
if k not in target_jsonschema["properties"]:
target_jsonschema["properties"][k] = v

_merge_missing(ADD_RECORD_METADATA_CONFIG, config_jsonschema)

capabilities = cls.capabilities

if PluginCapabilities.BATCH in capabilities:
Expand Down
1 change: 1 addition & 0 deletions tests/core/test_target_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ def test_target_about_info():
assert "flattening_enabled" in about.settings["properties"]
assert "flattening_max_depth" in about.settings["properties"]
assert "batch_config" in about.settings["properties"]
assert "add_record_metadata" in about.settings["properties"]

0 comments on commit 0fc6b51

Please sign in to comment.