fivetran-connector-sdk 1.1.4__py3-none-any.whl → 1.2.1__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.
- fivetran_connector_sdk/__init__.py +53 -14
- {fivetran_connector_sdk-1.1.4.dist-info → fivetran_connector_sdk-1.2.1.dist-info}/METADATA +1 -1
- {fivetran_connector_sdk-1.1.4.dist-info → fivetran_connector_sdk-1.2.1.dist-info}/RECORD +6 -6
- {fivetran_connector_sdk-1.1.4.dist-info → fivetran_connector_sdk-1.2.1.dist-info}/WHEEL +1 -1
- {fivetran_connector_sdk-1.1.4.dist-info → fivetran_connector_sdk-1.2.1.dist-info}/entry_points.txt +0 -0
- {fivetran_connector_sdk-1.1.4.dist-info → fivetran_connector_sdk-1.2.1.dist-info}/top_level.txt +0 -0
@@ -31,7 +31,7 @@ from fivetran_connector_sdk.protos import connector_sdk_pb2_grpc
|
|
31
31
|
|
32
32
|
# Version format: <major_version>.<minor_version>.<patch_version>
|
33
33
|
# (where Major Version = 1 for GA, Minor Version is incremental MM from Jan 25 onwards, Patch Version is incremental within a month)
|
34
|
-
__version__ = "1.1
|
34
|
+
__version__ = "1.2.1"
|
35
35
|
|
36
36
|
MAC_OS = "mac"
|
37
37
|
WIN_OS = "windows"
|
@@ -49,6 +49,7 @@ REQUIREMENTS_TXT = "requirements.txt"
|
|
49
49
|
PYPI_PACKAGE_DETAILS_URL = "https://pypi.org/pypi/fivetran_connector_sdk/json"
|
50
50
|
ONE_DAY_IN_SEC = 24 * 60 * 60
|
51
51
|
MAX_RETRIES = 3
|
52
|
+
VIRTUAL_ENV_CONFIG = "pyvenv.cfg"
|
52
53
|
|
53
54
|
# Compile patterns used in the implementation
|
54
55
|
WORD_DASH_DOT_PATTERN = re.compile(r'^[\w.-]*$')
|
@@ -161,7 +162,8 @@ class Operations:
|
|
161
162
|
Returns:
|
162
163
|
list[connector_sdk_pb2.UpdateResponse]: A list of update responses.
|
163
164
|
"""
|
164
|
-
|
165
|
+
if DEBUGGING:
|
166
|
+
_yield_check(inspect.stack())
|
165
167
|
|
166
168
|
responses = []
|
167
169
|
|
@@ -199,7 +201,8 @@ class Operations:
|
|
199
201
|
Returns:
|
200
202
|
connector_sdk_pb2.UpdateResponse: The update response.
|
201
203
|
"""
|
202
|
-
|
204
|
+
if DEBUGGING:
|
205
|
+
_yield_check(inspect.stack())
|
203
206
|
|
204
207
|
table = get_renamed_table_name(table)
|
205
208
|
columns = _get_columns(table)
|
@@ -225,7 +228,8 @@ class Operations:
|
|
225
228
|
Returns:
|
226
229
|
connector_sdk_pb2.UpdateResponse: The delete response.
|
227
230
|
"""
|
228
|
-
|
231
|
+
if DEBUGGING:
|
232
|
+
_yield_check(inspect.stack())
|
229
233
|
|
230
234
|
table = get_renamed_table_name(table)
|
231
235
|
columns = _get_columns(table)
|
@@ -261,7 +265,9 @@ class Operations:
|
|
261
265
|
Returns:
|
262
266
|
connector_sdk_pb2.UpdateResponse: The checkpoint response.
|
263
267
|
"""
|
264
|
-
|
268
|
+
if DEBUGGING:
|
269
|
+
_yield_check(inspect.stack())
|
270
|
+
|
265
271
|
return connector_sdk_pb2.UpdateResponse(
|
266
272
|
operation=connector_sdk_pb2.Operation(checkpoint=connector_sdk_pb2.Checkpoint(
|
267
273
|
state_json=json.dumps(state))))
|
@@ -431,8 +437,6 @@ def _yield_check(stack):
|
|
431
437
|
# the file paths. This can lead to unexpected behavior, such as yield returning None or
|
432
438
|
# the failure to retrieve the module inside a frozen app
|
433
439
|
# (Reference: https://github.com/pyinstaller/pyinstaller/issues/5963)
|
434
|
-
if not DEBUGGING:
|
435
|
-
return
|
436
440
|
|
437
441
|
called_method = stack[0].function
|
438
442
|
calling_code = stack[1].code_context[0]
|
@@ -444,7 +448,7 @@ def _yield_check(stack):
|
|
444
448
|
else:
|
445
449
|
# This should never happen
|
446
450
|
raise RuntimeError(
|
447
|
-
f"The '{called_method}' function is missing in the connector. Please ensure that the '{called_method}' function is properly defined in your code to proceed. Reference: https://fivetran.com/docs/connectors/connector-sdk/technical-reference#technicaldetailsmethods")
|
451
|
+
f"The '{called_method}' function is missing in the connector calling code '{calling_code}'. Please ensure that the '{called_method}' function is properly defined in your code to proceed. Reference: https://fivetran.com/docs/connectors/connector-sdk/technical-reference#technicaldetailsmethods")
|
448
452
|
|
449
453
|
|
450
454
|
def _check_dict(incoming: dict, string_only: bool = False) -> dict:
|
@@ -729,6 +733,13 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
729
733
|
force (bool): Force update an existing connection.
|
730
734
|
|
731
735
|
"""
|
736
|
+
# Detect and exclude virtual environment directories
|
737
|
+
venv_dirs = [name for name in os.listdir(project_path)
|
738
|
+
if os.path.isdir(os.path.join(project_path, name)) and
|
739
|
+
VIRTUAL_ENV_CONFIG in os.listdir(os.path.join(project_path, name))]
|
740
|
+
|
741
|
+
ignored_dirs = EXCLUDED_PIPREQS_DIRS + venv_dirs if venv_dirs else EXCLUDED_PIPREQS_DIRS
|
742
|
+
|
732
743
|
# tmp_requirements is only generated when pipreqs command is successful
|
733
744
|
tmp_requirements_file_path = os.path.join(project_path, 'tmp_requirements.txt')
|
734
745
|
# Run the pipreqs command and capture stderr
|
@@ -736,7 +747,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
736
747
|
while attempt < MAX_RETRIES:
|
737
748
|
attempt += 1
|
738
749
|
result = subprocess.run(
|
739
|
-
["pipreqs", project_path, "--savepath", tmp_requirements_file_path, "--ignore"
|
750
|
+
["pipreqs", project_path, "--savepath", tmp_requirements_file_path, "--ignore", ",".join(ignored_dirs)],
|
740
751
|
stderr=subprocess.PIPE,
|
741
752
|
text=True # Ensures output is in string format
|
742
753
|
)
|
@@ -1151,7 +1162,8 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
|
|
1151
1162
|
path = os.path.join(top, name)
|
1152
1163
|
if os.path.isdir(path):
|
1153
1164
|
if (name not in EXCLUDED_DIRS) and (not name.startswith(".")):
|
1154
|
-
|
1165
|
+
if VIRTUAL_ENV_CONFIG not in os.listdir(path): # Check for virtual env indicator
|
1166
|
+
dirs.append(name)
|
1155
1167
|
else:
|
1156
1168
|
# Include all files if in `drivers` folder
|
1157
1169
|
if os.path.basename(top) == DRIVERS:
|
@@ -1746,6 +1758,20 @@ def edit_distance(first_string: str, second_string: str) -> int:
|
|
1746
1758
|
return previous_row[second_string_length]
|
1747
1759
|
|
1748
1760
|
|
1761
|
+
def get_input_from_cli(prompt : str, default_value: str) -> str:
|
1762
|
+
"""
|
1763
|
+
Prompts the user for input.
|
1764
|
+
"""
|
1765
|
+
if default_value:
|
1766
|
+
value = input(f"{prompt} [Default : {default_value}]: ").strip() or default_value
|
1767
|
+
else:
|
1768
|
+
value = input(f"{prompt}: ").strip()
|
1769
|
+
|
1770
|
+
if not value:
|
1771
|
+
raise ValueError("Missing required input: Expected a value but received None")
|
1772
|
+
return value or None
|
1773
|
+
|
1774
|
+
|
1749
1775
|
def main():
|
1750
1776
|
"""The main entry point for the script.
|
1751
1777
|
Parses command line arguments and passes them to connector object methods
|
@@ -1785,9 +1811,9 @@ def main():
|
|
1785
1811
|
sys.exit(1)
|
1786
1812
|
|
1787
1813
|
# Process optional args
|
1788
|
-
ft_group = args.destination if args.destination else
|
1789
|
-
ft_connection = args.connection if args.connection else
|
1790
|
-
ft_deploy_key = args.api_key if args.api_key else
|
1814
|
+
ft_group = args.destination if args.destination else None
|
1815
|
+
ft_connection = args.connection if args.connection else None
|
1816
|
+
ft_deploy_key = args.api_key if args.api_key else None
|
1791
1817
|
hd_agent_id = args.hybrid_deployment_agent_id if args.hybrid_deployment_agent_id else os.getenv(FIVETRAN_HD_AGENT_ID, None)
|
1792
1818
|
configuration = args.configuration if args.configuration else None
|
1793
1819
|
state = args.state if args.state else os.getenv('FIVETRAN_STATE', None)
|
@@ -1795,14 +1821,27 @@ def main():
|
|
1795
1821
|
configuration = validate_and_load_configuration(args, configuration)
|
1796
1822
|
state = validate_and_load_state(args, state)
|
1797
1823
|
|
1824
|
+
FIVETRAN_API_KEY = os.getenv('FIVETRAN_API_KEY', None)
|
1825
|
+
FIVETRAN_DESTINATION_NAME = os.getenv('FIVETRAN_DESTINATION_NAME', None)
|
1826
|
+
FIVETRAN_CONNECTION_NAME = os.getenv('FIVETRAN_CONNECTION_NAME', None)
|
1827
|
+
|
1798
1828
|
if args.command.lower() == "deploy":
|
1799
1829
|
if args.state:
|
1800
1830
|
print_library_log("'state' parameter is not used for 'deploy' command", Logging.Level.WARNING)
|
1831
|
+
|
1832
|
+
if not ft_deploy_key:
|
1833
|
+
ft_deploy_key = get_input_from_cli("Please provide the API Key", FIVETRAN_API_KEY)
|
1834
|
+
|
1835
|
+
if not ft_group:
|
1836
|
+
ft_group = get_input_from_cli("Please provide the destination", FIVETRAN_DESTINATION_NAME)
|
1837
|
+
|
1838
|
+
if not ft_connection:
|
1839
|
+
ft_connection = get_input_from_cli("Please provide the connection name",FIVETRAN_CONNECTION_NAME)
|
1840
|
+
|
1801
1841
|
connector_object.deploy(args, ft_deploy_key, ft_group, ft_connection, hd_agent_id, configuration)
|
1802
1842
|
|
1803
1843
|
elif args.command.lower() == "debug":
|
1804
1844
|
connector_object.debug(args.project_path, configuration, state)
|
1805
|
-
|
1806
1845
|
else:
|
1807
1846
|
if not suggest_correct_command(args.command):
|
1808
1847
|
raise NotImplementedError(f"Invalid command: {args.command}, see `fivetran --help`")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: fivetran_connector_sdk
|
3
|
-
Version: 1.1
|
3
|
+
Version: 1.2.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
|
@@ -1,4 +1,4 @@
|
|
1
|
-
fivetran_connector_sdk/__init__.py,sha256=
|
1
|
+
fivetran_connector_sdk/__init__.py,sha256=3Kp8MaT8ZtvrOo_dNGFGt5mdumojUSPhYwNL7x6CBvE,80242
|
2
2
|
fivetran_connector_sdk/protos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
fivetran_connector_sdk/protos/common_pb2.py,sha256=kUwVcyZHgLigNR-KnHZn7dHrlxaMnUXqzprsRx6T72M,6831
|
4
4
|
fivetran_connector_sdk/protos/common_pb2.pyi,sha256=S0hdIzoXyyOKD5cjiGeDDLYpQ9J3LjAvu4rCj1JvJWE,9038
|
@@ -6,8 +6,8 @@ fivetran_connector_sdk/protos/common_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXH
|
|
6
6
|
fivetran_connector_sdk/protos/connector_sdk_pb2.py,sha256=9Ke_Ti1s0vAeXapfXT-EryrT2-TSGQb8mhs4gxTpUMk,7732
|
7
7
|
fivetran_connector_sdk/protos/connector_sdk_pb2.pyi,sha256=FWYxRgshEF3QDYAE0TM_mv4N2gGvkxCH_uPpxnMc4oA,8406
|
8
8
|
fivetran_connector_sdk/protos/connector_sdk_pb2_grpc.py,sha256=ZfJLp4DW7uP4pFOZ74s_wQ6tD3eIPi-08UfnLwe4tzo,7163
|
9
|
-
fivetran_connector_sdk-1.1.
|
10
|
-
fivetran_connector_sdk-1.1.
|
11
|
-
fivetran_connector_sdk-1.1.
|
12
|
-
fivetran_connector_sdk-1.1.
|
13
|
-
fivetran_connector_sdk-1.1.
|
9
|
+
fivetran_connector_sdk-1.2.1.dist-info/METADATA,sha256=3h_7qvx3Wv4GvLUTsNnTx2CLWCZpHtVTi-H-vScF4wA,2967
|
10
|
+
fivetran_connector_sdk-1.2.1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
11
|
+
fivetran_connector_sdk-1.2.1.dist-info/entry_points.txt,sha256=uQn0KPnFlQmXJfxlk0tifdNsSXWfVlnAFzNqjXZM_xM,57
|
12
|
+
fivetran_connector_sdk-1.2.1.dist-info/top_level.txt,sha256=-_xk2MFY4psIh7jw1lJePMzFb5-vask8_ZtX-UzYWUI,23
|
13
|
+
fivetran_connector_sdk-1.2.1.dist-info/RECORD,,
|
{fivetran_connector_sdk-1.1.4.dist-info → fivetran_connector_sdk-1.2.1.dist-info}/entry_points.txt
RENAMED
File without changes
|
{fivetran_connector_sdk-1.1.4.dist-info → fivetran_connector_sdk-1.2.1.dist-info}/top_level.txt
RENAMED
File without changes
|