Skip to content

Commit

Permalink
fix: Expose add_record_metadata as a builtin target setting (#1881)
Browse files Browse the repository at this point in the history
* fix: Append batch config if target supports the batch capability

* Test about info

* fix: Expose `add_record_metadata` as a builtin target setting

* Fix types

* Fix more types
  • Loading branch information
edgarrmondragon authored Jul 31, 2023
1 parent c3a8f90 commit 611d50d
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 @@ -595,6 +596,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 @@ -75,6 +75,7 @@ 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"]


def test_sql_get_sink():
Expand Down

0 comments on commit 611d50d

Please sign in to comment.