hotglue-singer-sdk 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hotglue_singer_sdk/__init__.py +34 -0
- hotglue_singer_sdk/authenticators.py +554 -0
- hotglue_singer_sdk/cli/__init__.py +1 -0
- hotglue_singer_sdk/cli/common_options.py +37 -0
- hotglue_singer_sdk/configuration/__init__.py +1 -0
- hotglue_singer_sdk/configuration/_dict_config.py +101 -0
- hotglue_singer_sdk/exceptions.py +52 -0
- hotglue_singer_sdk/helpers/__init__.py +1 -0
- hotglue_singer_sdk/helpers/_catalog.py +122 -0
- hotglue_singer_sdk/helpers/_classproperty.py +18 -0
- hotglue_singer_sdk/helpers/_compat.py +15 -0
- hotglue_singer_sdk/helpers/_flattening.py +374 -0
- hotglue_singer_sdk/helpers/_schema.py +100 -0
- hotglue_singer_sdk/helpers/_secrets.py +41 -0
- hotglue_singer_sdk/helpers/_simpleeval.py +678 -0
- hotglue_singer_sdk/helpers/_singer.py +280 -0
- hotglue_singer_sdk/helpers/_state.py +282 -0
- hotglue_singer_sdk/helpers/_typing.py +231 -0
- hotglue_singer_sdk/helpers/_util.py +27 -0
- hotglue_singer_sdk/helpers/capabilities.py +240 -0
- hotglue_singer_sdk/helpers/jsonpath.py +39 -0
- hotglue_singer_sdk/io_base.py +134 -0
- hotglue_singer_sdk/mapper.py +691 -0
- hotglue_singer_sdk/mapper_base.py +156 -0
- hotglue_singer_sdk/plugin_base.py +415 -0
- hotglue_singer_sdk/py.typed +0 -0
- hotglue_singer_sdk/sinks/__init__.py +14 -0
- hotglue_singer_sdk/sinks/batch.py +90 -0
- hotglue_singer_sdk/sinks/core.py +412 -0
- hotglue_singer_sdk/sinks/record.py +66 -0
- hotglue_singer_sdk/sinks/sql.py +299 -0
- hotglue_singer_sdk/streams/__init__.py +14 -0
- hotglue_singer_sdk/streams/core.py +1294 -0
- hotglue_singer_sdk/streams/graphql.py +74 -0
- hotglue_singer_sdk/streams/rest.py +611 -0
- hotglue_singer_sdk/streams/sql.py +1023 -0
- hotglue_singer_sdk/tap_base.py +580 -0
- hotglue_singer_sdk/target_base.py +554 -0
- hotglue_singer_sdk/target_sdk/__init__.py +0 -0
- hotglue_singer_sdk/target_sdk/auth.py +124 -0
- hotglue_singer_sdk/target_sdk/client.py +286 -0
- hotglue_singer_sdk/target_sdk/common.py +13 -0
- hotglue_singer_sdk/target_sdk/lambda.py +121 -0
- hotglue_singer_sdk/target_sdk/rest.py +108 -0
- hotglue_singer_sdk/target_sdk/sinks.py +16 -0
- hotglue_singer_sdk/target_sdk/target.py +570 -0
- hotglue_singer_sdk/target_sdk/target_base.py +627 -0
- hotglue_singer_sdk/testing.py +198 -0
- hotglue_singer_sdk/typing.py +603 -0
- hotglue_singer_sdk-1.0.2.dist-info/METADATA +53 -0
- hotglue_singer_sdk-1.0.2.dist-info/RECORD +53 -0
- hotglue_singer_sdk-1.0.2.dist-info/WHEEL +4 -0
- hotglue_singer_sdk-1.0.2.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Provides an object model for JSON Schema."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Any, List, Optional, Union
|
|
5
|
+
|
|
6
|
+
from singer import Schema
|
|
7
|
+
|
|
8
|
+
# These are keys defined in the JSON Schema spec that do not themselves contain
|
|
9
|
+
# schemas (or lists of schemas)
|
|
10
|
+
STANDARD_KEYS = [
|
|
11
|
+
"title",
|
|
12
|
+
"description",
|
|
13
|
+
"minimum",
|
|
14
|
+
"maximum",
|
|
15
|
+
"exclusiveMinimum",
|
|
16
|
+
"exclusiveMaximum",
|
|
17
|
+
"multipleOf",
|
|
18
|
+
"maxLength",
|
|
19
|
+
"minLength",
|
|
20
|
+
"format",
|
|
21
|
+
"type",
|
|
22
|
+
"required",
|
|
23
|
+
"enum",
|
|
24
|
+
# These are NOT simple keys (they can contain schemas themselves). We could
|
|
25
|
+
# consider adding extra handling to them.
|
|
26
|
+
"additionalProperties",
|
|
27
|
+
"anyOf",
|
|
28
|
+
"patternProperties",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class SchemaPlus(Schema):
|
|
34
|
+
"""Object model for JSON Schema.
|
|
35
|
+
|
|
36
|
+
Tap and Target authors may find this to be more convenient than
|
|
37
|
+
working directly with JSON Schema data structures.
|
|
38
|
+
|
|
39
|
+
This is based on, and overwrites
|
|
40
|
+
https://github.com/transferwise/pipelinewise-singer-python/blob/master/singer/schema.py.
|
|
41
|
+
This is because we wanted to expand it with extra STANDARD_KEYS.
|
|
42
|
+
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
type: Optional[Union[str, List[str]]] = None
|
|
46
|
+
properties: Optional[dict] = None
|
|
47
|
+
items: Optional[Any] = None
|
|
48
|
+
description: Optional[str] = None
|
|
49
|
+
minimum: Optional[float] = None
|
|
50
|
+
maximum: Optional[float] = None
|
|
51
|
+
exclusiveMinimum: Optional[float] = None
|
|
52
|
+
exclusiveMaximum: Optional[float] = None
|
|
53
|
+
multipleOf: Optional[float] = None
|
|
54
|
+
maxLength: Optional[int] = None
|
|
55
|
+
minLength: Optional[int] = None
|
|
56
|
+
anyOf: Optional[Any] = None
|
|
57
|
+
format: Optional[str] = None
|
|
58
|
+
additionalProperties: Optional[Any] = None
|
|
59
|
+
patternProperties: Optional[Any] = None
|
|
60
|
+
required: Optional[List[str]] = None
|
|
61
|
+
enum: Optional[List[Any]] = None
|
|
62
|
+
title: Optional[str] = None
|
|
63
|
+
|
|
64
|
+
def to_dict(self):
|
|
65
|
+
"""Return the raw JSON Schema as a (possibly nested) dict."""
|
|
66
|
+
result = {}
|
|
67
|
+
|
|
68
|
+
if self.properties is not None:
|
|
69
|
+
result["properties"] = {k: v.to_dict() for k, v in self.properties.items()}
|
|
70
|
+
|
|
71
|
+
if self.items is not None:
|
|
72
|
+
result["items"] = self.items.to_dict()
|
|
73
|
+
|
|
74
|
+
for key in STANDARD_KEYS:
|
|
75
|
+
if self.__dict__.get(key) is not None:
|
|
76
|
+
result[key] = self.__dict__[key]
|
|
77
|
+
|
|
78
|
+
return result
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, data, **schema_defaults):
|
|
82
|
+
"""Initialize a Schema object based on the JSON Schema structure.
|
|
83
|
+
|
|
84
|
+
:param schema_defaults: The default values to the Schema constructor.
|
|
85
|
+
"""
|
|
86
|
+
kwargs = schema_defaults.copy()
|
|
87
|
+
properties = data.get("properties")
|
|
88
|
+
items = data.get("items")
|
|
89
|
+
|
|
90
|
+
if properties is not None:
|
|
91
|
+
kwargs["properties"] = {
|
|
92
|
+
k: SchemaPlus.from_dict(v, **schema_defaults)
|
|
93
|
+
for k, v in properties.items()
|
|
94
|
+
}
|
|
95
|
+
if items is not None:
|
|
96
|
+
kwargs["items"] = SchemaPlus.from_dict(items, **schema_defaults)
|
|
97
|
+
for key in STANDARD_KEYS:
|
|
98
|
+
if key in data:
|
|
99
|
+
kwargs[key] = data[key]
|
|
100
|
+
return SchemaPlus(**kwargs)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Helpers function for secrets management."""
|
|
2
|
+
|
|
3
|
+
COMMON_SECRET_KEYS = [
|
|
4
|
+
"db_password",
|
|
5
|
+
"password",
|
|
6
|
+
"access_key",
|
|
7
|
+
"private_key",
|
|
8
|
+
"client_id",
|
|
9
|
+
"client_secret",
|
|
10
|
+
"refresh_token",
|
|
11
|
+
"access_token",
|
|
12
|
+
]
|
|
13
|
+
COMMON_SECRET_KEY_SUFFIXES = ["access_key_id"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def is_common_secret_key(key_name: str) -> bool:
|
|
17
|
+
"""Return true if the key_name value matches a known secret name or pattern."""
|
|
18
|
+
if key_name in COMMON_SECRET_KEYS:
|
|
19
|
+
return True
|
|
20
|
+
return any(
|
|
21
|
+
[
|
|
22
|
+
key_name.lower().endswith(key_suffix)
|
|
23
|
+
for key_suffix in COMMON_SECRET_KEY_SUFFIXES
|
|
24
|
+
]
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class SecretString(str):
|
|
29
|
+
"""For now, this class wraps a sensitive string to be identified as such later."""
|
|
30
|
+
|
|
31
|
+
def __init__(self, contents):
|
|
32
|
+
"""Initialize secret string."""
|
|
33
|
+
self.contents = contents
|
|
34
|
+
|
|
35
|
+
def __repr__(self) -> str:
|
|
36
|
+
"""Render secret contents."""
|
|
37
|
+
return str(self.contents.__repr__())
|
|
38
|
+
|
|
39
|
+
def __str__(self) -> str:
|
|
40
|
+
"""Render secret contents."""
|
|
41
|
+
return str(self.contents.__str__())
|