forked from meltano/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(targets)!: Default handling of
ACTIVATE_VERSION
messages to sof…
…t deletes and add new `SQLConnector.delete_old_versions` method (meltano#2105) * fix(targets): Default handling of `ACTIVATE_VERSION` messages to soft deletes * Test SQL target capabilities info
- Loading branch information
1 parent
f914452
commit a79cff8
Showing
7 changed files
with
103 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from __future__ import annotations | ||
|
||
import typing as t | ||
|
||
import pytest | ||
|
||
from singer_sdk.helpers.capabilities import CapabilitiesEnum, TargetCapabilities | ||
from singer_sdk.target_base import SQLTarget | ||
|
||
|
||
class SQLTargetMock(SQLTarget): | ||
name = "sql-target-mock" | ||
|
||
def __init_subclass__( | ||
cls, | ||
*, | ||
capabilities: t.Iterable[CapabilitiesEnum], | ||
**kwargs: t.Any, | ||
): | ||
super().__init_subclass__(**kwargs) | ||
cls.capabilities = [*capabilities] | ||
cls.config_jsonschema = {"properties": {}} | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"capabilities,expected_settings", | ||
[ | ||
pytest.param([], set(), id="no capabilities"), | ||
pytest.param( | ||
[TargetCapabilities.TARGET_SCHEMA], | ||
{"default_target_schema"}, | ||
id="default schema", | ||
), | ||
pytest.param( | ||
[TargetCapabilities.HARD_DELETE], | ||
{"hard_delete"}, | ||
id="hard delete", | ||
), | ||
], | ||
) | ||
def test_target_about_info( | ||
capabilities: list[CapabilitiesEnum], | ||
expected_settings: set[str], | ||
): | ||
class MyTarget(SQLTargetMock, capabilities=capabilities): | ||
pass | ||
|
||
about = MyTarget._get_about_info() | ||
default_settings = {"add_record_metadata", "load_method"} | ||
assert set(about.settings["properties"]) == expected_settings | default_settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters