fivetran-connector-sdk 1.4.6__tar.gz → 1.5.0__tar.gz
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.
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/PKG-INFO +4 -4
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/pyproject.toml +3 -3
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/__init__.py +3 -3
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/helpers.py +5 -2
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/logger.py +11 -6
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/operations.py +29 -43
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk.egg-info/PKG-INFO +4 -4
- fivetran_connector_sdk-1.5.0/src/fivetran_connector_sdk.egg-info/requires.txt +5 -0
- fivetran_connector_sdk-1.4.6/src/fivetran_connector_sdk.egg-info/requires.txt +0 -5
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/README.md +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/setup.cfg +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/connector_helper.py +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/constants.py +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/protos/__init__.py +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/protos/common_pb2.py +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/protos/common_pb2.pyi +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/protos/common_pb2_grpc.py +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.py +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.pyi +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/protos/connector_sdk_pb2_grpc.py +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk.egg-info/SOURCES.txt +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk.egg-info/dependency_links.txt +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk.egg-info/entry_points.txt +0 -0
- {fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fivetran_connector_sdk
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.5.0
|
4
4
|
Summary: Build custom connectors on Fivetran platform
|
5
5
|
Author-email: Fivetran <developers@fivetran.com>
|
6
6
|
Project-URL: Homepage, https://fivetran.com/docs/connectors/connector-sdk
|
@@ -11,11 +11,11 @@ Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
12
12
|
Requires-Python: >=3.9
|
13
13
|
Description-Content-Type: text/markdown
|
14
|
-
Requires-Dist: grpcio==1.
|
15
|
-
Requires-Dist: grpcio-tools==1.
|
14
|
+
Requires-Dist: grpcio==1.71.0
|
15
|
+
Requires-Dist: grpcio-tools==1.71.0
|
16
16
|
Requires-Dist: requests==2.32.3
|
17
17
|
Requires-Dist: pipreqs==0.5.0
|
18
|
-
Requires-Dist: unidecode==1.
|
18
|
+
Requires-Dist: unidecode==1.4.0
|
19
19
|
|
20
20
|
# **fivetran-connector-sdk**
|
21
21
|
[](https://pepy.tech/project/fivetran-connector-sdk)
|
@@ -13,11 +13,11 @@ classifiers = [
|
|
13
13
|
"Operating System :: OS Independent",
|
14
14
|
]
|
15
15
|
dependencies = [
|
16
|
-
"grpcio==1.
|
17
|
-
"grpcio-tools==1.
|
16
|
+
"grpcio==1.71.0",
|
17
|
+
"grpcio-tools==1.71.0",
|
18
18
|
"requests==2.32.3",
|
19
19
|
"pipreqs==0.5.0",
|
20
|
-
"unidecode==1.
|
20
|
+
"unidecode==1.4.0"
|
21
21
|
]
|
22
22
|
|
23
23
|
[project.scripts]
|
{fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/__init__.py
RENAMED
@@ -39,7 +39,7 @@ from fivetran_connector_sdk.connector_helper import (
|
|
39
39
|
|
40
40
|
# Version format: <major_version>.<minor_version>.<patch_version>
|
41
41
|
# (where Major Version = 1 for GA, Minor Version is incremental MM from Jan 25 onwards, Patch Version is incremental within a month)
|
42
|
-
__version__ = "1.
|
42
|
+
__version__ = "1.5.0"
|
43
43
|
TESTER_VERSION = TESTER_VER
|
44
44
|
|
45
45
|
__all__ = [cls.__name__ for cls in [Logging, Operations]]
|
@@ -420,7 +420,7 @@ def main():
|
|
420
420
|
configuration = validate_and_load_configuration(args, configuration)
|
421
421
|
state = validate_and_load_state(args, state)
|
422
422
|
|
423
|
-
|
423
|
+
FIVETRAN_BASE_64_ENCODED_API_KEY = os.getenv('FIVETRAN_BASE_64_ENCODED_API_KEY', None)
|
424
424
|
FIVETRAN_DESTINATION_NAME = os.getenv('FIVETRAN_DESTINATION_NAME', None)
|
425
425
|
FIVETRAN_CONNECTION_NAME = os.getenv('FIVETRAN_CONNECTION_NAME', None)
|
426
426
|
|
@@ -429,7 +429,7 @@ def main():
|
|
429
429
|
print_library_log("'state' parameter is not used for 'deploy' command", Logging.Level.WARNING)
|
430
430
|
|
431
431
|
if not ft_deploy_key:
|
432
|
-
ft_deploy_key = get_input_from_cli("Please provide the API Key",
|
432
|
+
ft_deploy_key = get_input_from_cli("Please provide the API Key", FIVETRAN_BASE_64_ENCODED_API_KEY)
|
433
433
|
|
434
434
|
if not ft_group:
|
435
435
|
ft_group = get_input_from_cli("Please provide the destination", FIVETRAN_DESTINATION_NAME)
|
{fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/helpers.py
RENAMED
@@ -304,8 +304,11 @@ def validate_and_load_state(args, state):
|
|
304
304
|
|
305
305
|
def reset_local_file_directory(args):
|
306
306
|
files_path = os.path.join(args.project_path, OUTPUT_FILES_DIR)
|
307
|
-
|
308
|
-
|
307
|
+
if args.force:
|
308
|
+
confirm = "y"
|
309
|
+
else:
|
310
|
+
confirm = input(
|
311
|
+
"This will delete your current state and `warehouse.db` files. Do you want to continue? (Y/N): ")
|
309
312
|
if confirm.lower() != "y":
|
310
313
|
print_library_log("Reset canceled")
|
311
314
|
else:
|
{fivetran_connector_sdk-1.4.6 → fivetran_connector_sdk-1.5.0}/src/fivetran_connector_sdk/logger.py
RENAMED
@@ -24,12 +24,20 @@ class Logging:
|
|
24
24
|
"""
|
25
25
|
if constants.DEBUGGING:
|
26
26
|
current_time = datetime.now().strftime("%b %d, %Y %I:%M:%S %p")
|
27
|
-
|
27
|
+
prefix = f"{current_time} {level.name}: "
|
28
|
+
message = Logging.get_formatted_log(message, prefix)
|
29
|
+
print(f"{Logging.get_color(level)}{prefix}{message} {Logging.reset_color()}")
|
28
30
|
else:
|
29
31
|
escaped_message = json.dumps(message)
|
30
32
|
log_message = f'{{"level":"{level.name}", "message": {escaped_message}, "message_origin": "connector_sdk"}}'
|
31
33
|
print(log_message)
|
32
34
|
|
35
|
+
@staticmethod
|
36
|
+
def get_formatted_log(message, prefix):
|
37
|
+
lines = message.split('\n')
|
38
|
+
padding = "\n" + " " * len(prefix)
|
39
|
+
return padding.join(lines)
|
40
|
+
|
33
41
|
@staticmethod
|
34
42
|
def get_color(level):
|
35
43
|
if level == Logging.Level.WARNING:
|
@@ -81,11 +89,8 @@ class Logging:
|
|
81
89
|
exception (Exception, optional): Exception to be logged if provided.
|
82
90
|
"""
|
83
91
|
if Logging.LOG_LEVEL <= Logging.Level.SEVERE:
|
84
|
-
Logging.__log(Logging.Level.SEVERE, message)
|
85
|
-
|
86
92
|
if exception:
|
87
93
|
exc_type, exc_value, exc_traceback = type(exception), exception, exception.__traceback__
|
88
94
|
tb_str = "".join(traceback.format_exception(exc_type, exc_value, exc_traceback, limit=1))
|
89
|
-
|
90
|
-
|
91
|
-
Logging.__log(Logging.Level.SEVERE, error)
|
95
|
+
message += "\n" + tb_str
|
96
|
+
Logging.__log(Logging.Level.SEVERE, message)
|
@@ -18,6 +18,29 @@ from fivetran_connector_sdk.helpers import (
|
|
18
18
|
from fivetran_connector_sdk.logger import Logging
|
19
19
|
from fivetran_connector_sdk.protos import connector_sdk_pb2, common_pb2
|
20
20
|
|
21
|
+
_TYPE_HANDLERS = {
|
22
|
+
common_pb2.DataType.BOOLEAN: lambda val: common_pb2.ValueType(bool=val),
|
23
|
+
common_pb2.DataType.SHORT: lambda val: common_pb2.ValueType(short=val),
|
24
|
+
common_pb2.DataType.INT: lambda val: common_pb2.ValueType(int=val),
|
25
|
+
common_pb2.DataType.LONG: lambda val: common_pb2.ValueType(long=val),
|
26
|
+
common_pb2.DataType.DECIMAL: lambda val: common_pb2.ValueType(decimal=val),
|
27
|
+
common_pb2.DataType.FLOAT: lambda val: common_pb2.ValueType(float=val),
|
28
|
+
common_pb2.DataType.DOUBLE: lambda val: common_pb2.ValueType(double=val),
|
29
|
+
common_pb2.DataType.NAIVE_DATE: lambda val: common_pb2.ValueType(naive_date=
|
30
|
+
timestamp_pb2.Timestamp().FromDatetime(
|
31
|
+
datetime.strptime(val, "%Y-%m-%d")) or timestamp_pb2.Timestamp()),
|
32
|
+
common_pb2.DataType.NAIVE_DATETIME: lambda val: common_pb2.ValueType(naive_datetime=
|
33
|
+
timestamp_pb2.Timestamp().FromDatetime(
|
34
|
+
datetime.strptime(val + ".0" if '.' not in val else val, "%Y-%m-%dT%H:%M:%S.%f")) or timestamp_pb2.Timestamp()),
|
35
|
+
common_pb2.DataType.UTC_DATETIME: lambda val: common_pb2.ValueType(utc_datetime=
|
36
|
+
timestamp_pb2.Timestamp().FromDatetime(
|
37
|
+
val if isinstance(val, datetime) else _parse_datetime_str(val)) or timestamp_pb2.Timestamp()),
|
38
|
+
common_pb2.DataType.BINARY: lambda val: common_pb2.ValueType(binary=val),
|
39
|
+
common_pb2.DataType.XML: lambda val: common_pb2.ValueType(xml=val),
|
40
|
+
common_pb2.DataType.STRING: lambda val: common_pb2.ValueType(string=val if isinstance(val, str) else str(val)),
|
41
|
+
common_pb2.DataType.JSON: lambda val: common_pb2.ValueType(json=json.dumps(val))
|
42
|
+
}
|
43
|
+
|
21
44
|
class Operations:
|
22
45
|
@staticmethod
|
23
46
|
def upsert(table: str, data: dict) -> list[connector_sdk_pb2.UpdateResponse]:
|
@@ -174,7 +197,7 @@ def _map_data_to_columns(data: dict, columns: dict) -> dict:
|
|
174
197
|
if v is None:
|
175
198
|
mapped_data[key] = common_pb2.ValueType(null=True)
|
176
199
|
elif (key in columns) and columns[key].type != common_pb2.DataType.UNSPECIFIED:
|
177
|
-
map_defined_data_type(columns, key, mapped_data, v)
|
200
|
+
map_defined_data_type(columns[key].type, key, mapped_data, v)
|
178
201
|
else:
|
179
202
|
map_inferred_data_type(key, mapped_data, v)
|
180
203
|
return mapped_data
|
@@ -203,49 +226,12 @@ def map_inferred_data_type(k, mapped_data, v):
|
|
203
226
|
# Convert arbitrary objects to string
|
204
227
|
mapped_data[k] = common_pb2.ValueType(string=str(v))
|
205
228
|
|
206
|
-
|
207
|
-
|
208
|
-
if
|
209
|
-
mapped_data[k] =
|
210
|
-
elif columns[k].type == common_pb2.DataType.SHORT:
|
211
|
-
mapped_data[k] = common_pb2.ValueType(short=v)
|
212
|
-
elif columns[k].type == common_pb2.DataType.INT:
|
213
|
-
mapped_data[k] = common_pb2.ValueType(int=v)
|
214
|
-
elif columns[k].type == common_pb2.DataType.LONG:
|
215
|
-
mapped_data[k] = common_pb2.ValueType(long=v)
|
216
|
-
elif columns[k].type == common_pb2.DataType.DECIMAL:
|
217
|
-
mapped_data[k] = common_pb2.ValueType(decimal=v)
|
218
|
-
elif columns[k].type == common_pb2.DataType.FLOAT:
|
219
|
-
mapped_data[k] = common_pb2.ValueType(float=v)
|
220
|
-
elif columns[k].type == common_pb2.DataType.DOUBLE:
|
221
|
-
mapped_data[k] = common_pb2.ValueType(double=v)
|
222
|
-
elif columns[k].type == common_pb2.DataType.NAIVE_DATE:
|
223
|
-
timestamp = timestamp_pb2.Timestamp()
|
224
|
-
dt = datetime.strptime(v, "%Y-%m-%d")
|
225
|
-
timestamp.FromDatetime(dt)
|
226
|
-
mapped_data[k] = common_pb2.ValueType(naive_date=timestamp)
|
227
|
-
elif columns[k].type == common_pb2.DataType.NAIVE_DATETIME:
|
228
|
-
if '.' not in v: v = v + ".0"
|
229
|
-
timestamp = timestamp_pb2.Timestamp()
|
230
|
-
dt = datetime.strptime(v, "%Y-%m-%dT%H:%M:%S.%f")
|
231
|
-
timestamp.FromDatetime(dt)
|
232
|
-
mapped_data[k] = common_pb2.ValueType(naive_datetime=timestamp)
|
233
|
-
elif columns[k].type == common_pb2.DataType.UTC_DATETIME:
|
234
|
-
timestamp = timestamp_pb2.Timestamp()
|
235
|
-
dt = v if isinstance(v, datetime) else _parse_datetime_str(v)
|
236
|
-
timestamp.FromDatetime(dt)
|
237
|
-
mapped_data[k] = common_pb2.ValueType(utc_datetime=timestamp)
|
238
|
-
elif columns[k].type == common_pb2.DataType.BINARY:
|
239
|
-
mapped_data[k] = common_pb2.ValueType(binary=v)
|
240
|
-
elif columns[k].type == common_pb2.DataType.XML:
|
241
|
-
mapped_data[k] = common_pb2.ValueType(xml=v)
|
242
|
-
elif columns[k].type == common_pb2.DataType.STRING:
|
243
|
-
incoming = v if isinstance(v, str) else str(v)
|
244
|
-
mapped_data[k] = common_pb2.ValueType(string=incoming)
|
245
|
-
elif columns[k].type == common_pb2.DataType.JSON:
|
246
|
-
mapped_data[k] = common_pb2.ValueType(json=json.dumps(v))
|
229
|
+
def map_defined_data_type(data_type, k, mapped_data, v):
|
230
|
+
handler = _TYPE_HANDLERS.get(data_type)
|
231
|
+
if handler:
|
232
|
+
mapped_data[k] = handler(v)
|
247
233
|
else:
|
248
|
-
raise ValueError(f"Unsupported data type encountered: {
|
234
|
+
raise ValueError(f"Unsupported data type encountered: {data_type}. Please use valid data types.")
|
249
235
|
|
250
236
|
def _parse_datetime_str(dt):
|
251
237
|
return datetime.strptime(dt, "%Y-%m-%dT%H:%M:%S.%f%z" if '.' in dt else "%Y-%m-%dT%H:%M:%S%z")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fivetran_connector_sdk
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.5.0
|
4
4
|
Summary: Build custom connectors on Fivetran platform
|
5
5
|
Author-email: Fivetran <developers@fivetran.com>
|
6
6
|
Project-URL: Homepage, https://fivetran.com/docs/connectors/connector-sdk
|
@@ -11,11 +11,11 @@ Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
12
12
|
Requires-Python: >=3.9
|
13
13
|
Description-Content-Type: text/markdown
|
14
|
-
Requires-Dist: grpcio==1.
|
15
|
-
Requires-Dist: grpcio-tools==1.
|
14
|
+
Requires-Dist: grpcio==1.71.0
|
15
|
+
Requires-Dist: grpcio-tools==1.71.0
|
16
16
|
Requires-Dist: requests==2.32.3
|
17
17
|
Requires-Dist: pipreqs==0.5.0
|
18
|
-
Requires-Dist: unidecode==1.
|
18
|
+
Requires-Dist: unidecode==1.4.0
|
19
19
|
|
20
20
|
# **fivetran-connector-sdk**
|
21
21
|
[](https://pepy.tech/project/fivetran-connector-sdk)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|