fivetran-connector-sdk 0.12.9.2__tar.gz → 0.12.17.1__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-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/PKG-INFO +1 -1
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk/__init__.py +34 -15
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk.egg-info/PKG-INFO +1 -1
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/README.md +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/pyproject.toml +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/setup.cfg +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk/protos/__init__.py +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk/protos/common_pb2.py +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk/protos/common_pb2.pyi +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk/protos/common_pb2_grpc.py +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.py +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.pyi +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk/protos/connector_sdk_pb2_grpc.py +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk.egg-info/SOURCES.txt +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk.egg-info/dependency_links.txt +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk.egg-info/entry_points.txt +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk.egg-info/requires.txt +0 -0
- {fivetran_connector_sdk-0.12.9.2 → fivetran_connector_sdk-0.12.17.1}/src/fivetran_connector_sdk.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fivetran_connector_sdk
|
3
|
-
Version: 0.12.
|
3
|
+
Version: 0.12.17.1
|
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
|
@@ -26,18 +26,19 @@ from fivetran_connector_sdk.protos import common_pb2
|
|
26
26
|
from fivetran_connector_sdk.protos import connector_sdk_pb2
|
27
27
|
from fivetran_connector_sdk.protos import connector_sdk_pb2_grpc
|
28
28
|
|
29
|
-
__version__ = "0.12.
|
29
|
+
__version__ = "0.12.17.1"
|
30
30
|
|
31
31
|
MAC_OS = "mac"
|
32
32
|
WIN_OS = "windows"
|
33
33
|
LINUX_OS = "linux"
|
34
34
|
|
35
|
-
TESTER_VERSION = "0.24.
|
35
|
+
TESTER_VERSION = "0.24.1209.001"
|
36
36
|
TESTER_FILENAME = "run_sdk_tester.jar"
|
37
37
|
VERSION_FILENAME = "version.txt"
|
38
38
|
UPLOAD_FILENAME = "code.zip"
|
39
39
|
LAST_VERSION_CHECK_FILE = "_last_version_check"
|
40
40
|
ROOT_LOCATION = ".ft_sdk_connector_tester"
|
41
|
+
CONFIG_FILE = "_config.json"
|
41
42
|
OUTPUT_FILES_DIR = "files"
|
42
43
|
REQUIREMENTS_TXT = "requirements.txt"
|
43
44
|
PYPI_PACKAGE_DETAILS_URL = "https://pypi.org/pypi/fivetran_connector_sdk/json"
|
@@ -57,9 +58,11 @@ COMMANDS_AND_SYNONYMS = {
|
|
57
58
|
CONNECTION_SCHEMA_NAME_PATTERN = r'^[_a-z][_a-z0-9]*$'
|
58
59
|
DEBUGGING = False
|
59
60
|
EXECUTED_VIA_CLI = False
|
61
|
+
PRODUCTION_BASE_URL = "https://api.fivetran.com"
|
60
62
|
TABLES = {}
|
61
63
|
|
62
64
|
JAVA_LONG_MAX_VALUE = 9223372036854775807
|
65
|
+
MAX_CONFIG_FIELDS = 100
|
63
66
|
|
64
67
|
|
65
68
|
class Logging:
|
@@ -507,6 +510,18 @@ def get_available_port():
|
|
507
510
|
return None
|
508
511
|
|
509
512
|
|
513
|
+
def update_base_url_if_required():
|
514
|
+
config_file_path = os.path.join(_tester_root_dir(), CONFIG_FILE)
|
515
|
+
if os.path.isfile(config_file_path):
|
516
|
+
with open(config_file_path, 'r') as f:
|
517
|
+
data = json.load(f)
|
518
|
+
base_url = data.get('production_base_url')
|
519
|
+
if base_url is not None:
|
520
|
+
global PRODUCTION_BASE_URL
|
521
|
+
PRODUCTION_BASE_URL = base_url
|
522
|
+
print_library_log(f"Updating PRODUCTION_BASE_URL to: {base_url}")
|
523
|
+
|
524
|
+
|
510
525
|
class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
511
526
|
def __init__(self, update, schema=None):
|
512
527
|
"""Initializes the Connector instance.
|
@@ -521,6 +536,8 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
521
536
|
self.configuration = None
|
522
537
|
self.state = None
|
523
538
|
|
539
|
+
update_base_url_if_required()
|
540
|
+
|
524
541
|
@staticmethod
|
525
542
|
def fetch_requirements_from_file(file_path: str) -> list[str]:
|
526
543
|
"""Reads a requirements file and returns a list of dependencies.
|
@@ -650,6 +667,8 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
650
667
|
global EXECUTED_VIA_CLI
|
651
668
|
EXECUTED_VIA_CLI = True
|
652
669
|
|
670
|
+
print_library_log("We support only `.py` files and a `requirements.txt` file as part of the code upload. *No other code files* are supported or uploaded during the deployment process. Ensure that your code is structured accordingly and all dependencies are listed in `requirements.txt`")
|
671
|
+
|
653
672
|
validate_deploy_parameters(connection, deploy_key)
|
654
673
|
|
655
674
|
_check_dict(configuration, True)
|
@@ -743,7 +762,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
743
762
|
if not config["secrets_list"]:
|
744
763
|
del config["secrets_list"]
|
745
764
|
|
746
|
-
resp = rq.patch(f"
|
765
|
+
resp = rq.patch(f"{PRODUCTION_BASE_URL}/v1/connectors/{id}",
|
747
766
|
headers={"Authorization": f"Basic {deploy_key}"},
|
748
767
|
json={
|
749
768
|
"config": config,
|
@@ -768,7 +787,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
768
787
|
Returns:
|
769
788
|
str: The connection ID, or None
|
770
789
|
"""
|
771
|
-
resp = rq.get(f"
|
790
|
+
resp = rq.get(f"{PRODUCTION_BASE_URL}/v1/groups/{group_id}/connectors",
|
772
791
|
headers={"Authorization": f"Basic {deploy_key}"},
|
773
792
|
params={"schema": name})
|
774
793
|
if not resp.ok:
|
@@ -793,7 +812,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
793
812
|
Returns:
|
794
813
|
rq.Response: The response object.
|
795
814
|
"""
|
796
|
-
response = rq.post(f"
|
815
|
+
response = rq.post(f"{PRODUCTION_BASE_URL}/v1/connectors",
|
797
816
|
headers={"Authorization": f"Basic {deploy_key}"},
|
798
817
|
json={
|
799
818
|
"group_id": group_id,
|
@@ -885,7 +904,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
885
904
|
bool: True if the upload was successful, False otherwise.
|
886
905
|
"""
|
887
906
|
print_library_log("Uploading your project...")
|
888
|
-
response = rq.post(f"
|
907
|
+
response = rq.post(f"{PRODUCTION_BASE_URL}/v1/deploy/{group_id}/{connection}",
|
889
908
|
files={'file': open(local_path, 'rb')},
|
890
909
|
headers={"Authorization": f"Basic {deploy_key}"})
|
891
910
|
if response.ok:
|
@@ -908,7 +927,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
908
927
|
bool: True if the cleanup was successful, False otherwise.
|
909
928
|
"""
|
910
929
|
print_library_log("INFO: Cleaning up your uploaded project ")
|
911
|
-
response = rq.post(f"
|
930
|
+
response = rq.post(f"{PRODUCTION_BASE_URL}/v1/cleanup_code/{group_id}/{connection}",
|
912
931
|
headers={"Authorization": f"Basic {deploy_key}"})
|
913
932
|
if response.ok:
|
914
933
|
print("✓")
|
@@ -944,7 +963,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
944
963
|
Returns:
|
945
964
|
tuple[str, str]: A tuple containing the group ID and group name.
|
946
965
|
"""
|
947
|
-
groups_url = "
|
966
|
+
groups_url = f"{PRODUCTION_BASE_URL}/v1/groups"
|
948
967
|
|
949
968
|
params = {"limit": 500}
|
950
969
|
headers = {"Authorization": f"Basic {deploy_key}"}
|
@@ -1093,8 +1112,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
1093
1112
|
print("✓")
|
1094
1113
|
except:
|
1095
1114
|
shutil.rmtree(tester_root_dir)
|
1096
|
-
raise RuntimeError(f"\nSEVERE: Failed to install the connector tester. Error details: "
|
1097
|
-
traceback.format_exc())
|
1115
|
+
raise RuntimeError(f"\nSEVERE: Failed to install the connector tester. Error details: {traceback.format_exc()}")
|
1098
1116
|
|
1099
1117
|
project_path = os.getcwd() if project_path is None else project_path
|
1100
1118
|
self.validate_requirements_file(project_path, False)
|
@@ -1111,7 +1129,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
1111
1129
|
# server.wait_for_termination()
|
1112
1130
|
|
1113
1131
|
try:
|
1114
|
-
print_library_log(
|
1132
|
+
print_library_log("Running connector tester...")
|
1115
1133
|
for log_msg in self.__run_tester(java_exe, tester_root_dir, project_path, available_port):
|
1116
1134
|
print(log_msg, end="")
|
1117
1135
|
except:
|
@@ -1146,12 +1164,11 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
1146
1164
|
Yields:
|
1147
1165
|
str: Each line from the stream after replacing the matched pattern with the replacement string.
|
1148
1166
|
"""
|
1149
|
-
pattern =
|
1150
|
-
replacement = 'Fivetran SDK Tester'
|
1167
|
+
pattern = r'com\.fivetran\.fivetran_sdk.*\.tools\.testers\.\S+'
|
1151
1168
|
|
1152
1169
|
for line in iter(stream.readline, ""):
|
1153
|
-
|
1154
|
-
|
1170
|
+
if not re.search(pattern, line):
|
1171
|
+
yield line
|
1155
1172
|
|
1156
1173
|
@staticmethod
|
1157
1174
|
def __run_tester(java_exe: str, root_dir: str, project_path: str, port: int):
|
@@ -1504,6 +1521,8 @@ def validate_and_load_configuration(args, configuration):
|
|
1504
1521
|
if os.path.isfile(json_filepath):
|
1505
1522
|
with open(json_filepath, 'r') as fi:
|
1506
1523
|
configuration = json.load(fi)
|
1524
|
+
if len(configuration) > MAX_CONFIG_FIELDS:
|
1525
|
+
raise ValueError(f"Configuration field count exceeds maximum of {MAX_CONFIG_FIELDS}. Reduce the field count.")
|
1507
1526
|
else:
|
1508
1527
|
raise ValueError(
|
1509
1528
|
"Configuration must be provided as a JSON file. Please check your input. Reference: "
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fivetran_connector_sdk
|
3
|
-
Version: 0.12.
|
3
|
+
Version: 0.12.17.1
|
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
|
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
|