fivetran-connector-sdk 1.4.0__py3-none-any.whl → 1.4.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.
@@ -32,13 +32,13 @@ from fivetran_connector_sdk.protos import connector_sdk_pb2_grpc
32
32
 
33
33
  # Version format: <major_version>.<minor_version>.<patch_version>
34
34
  # (where Major Version = 1 for GA, Minor Version is incremental MM from Jan 25 onwards, Patch Version is incremental within a month)
35
- __version__ = "1.4.0"
35
+ __version__ = "1.4.2"
36
36
 
37
37
  MAC_OS = "mac"
38
38
  WIN_OS = "windows"
39
39
  LINUX_OS = "linux"
40
40
 
41
- TESTER_VERSION = "0.25.0424.001"
41
+ TESTER_VERSION = "0.25.0507.001"
42
42
  TESTER_FILENAME = "run_sdk_tester.jar"
43
43
  VERSION_FILENAME = "version.txt"
44
44
  UPLOAD_FILENAME = "code.zip"
@@ -772,6 +772,8 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
772
772
  values are the full dependency strings.
773
773
  """
774
774
  requirements_dict = {}
775
+ if not os.path.exists(file_path):
776
+ return requirements_dict
775
777
  for requirement in self.fetch_requirements_from_file(file_path):
776
778
  requirement = requirement.strip()
777
779
  if not requirement or requirement.startswith("#"): # Skip empty lines and comments
@@ -805,6 +807,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
805
807
  ignored_dirs = EXCLUDED_PIPREQS_DIRS + venv_dirs if venv_dirs else EXCLUDED_PIPREQS_DIRS
806
808
 
807
809
  # tmp_requirements is only generated when pipreqs command is successful
810
+ requirements_file_path = os.path.join(project_path, REQUIREMENTS_TXT)
808
811
  tmp_requirements_file_path = os.path.join(project_path, 'tmp_requirements.txt')
809
812
  # copying packages of requirements file to tmp file to handle pipreqs fail use-case
810
813
  self.copy_requirements_file_to_tmp_requirements_file(os.path.join(project_path, REQUIREMENTS_TXT), tmp_requirements_file_path)
@@ -842,7 +845,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
842
845
  del tmp_requirements[requirement]
843
846
 
844
847
  if len(tmp_requirements) > 0:
845
- requirements = self.load_or_add_requirements_file(project_path)
848
+ requirements = self.load_or_add_requirements_file(requirements_file_path)
846
849
 
847
850
  version_mismatch_deps = {key: tmp_requirements[key] for key in
848
851
  (requirements.keys() & tmp_requirements.keys())
@@ -888,15 +891,18 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
888
891
  if force:
889
892
  requirements = tmp_requirements
890
893
 
891
- with open(REQUIREMENTS_TXT, "w", encoding=UTF_8) as file:
894
+ with open(requirements_file_path, "w", encoding=UTF_8) as file:
892
895
  file.write("\n".join(requirements.values()))
893
896
  print_library_log(f"`{REQUIREMENTS_TXT}` has been updated successfully")
894
897
 
895
898
  else:
896
- if os.path.exists(REQUIREMENTS_TXT):
899
+ if os.path.exists(requirements_file_path):
897
900
  print_library_log("`requirements.txt` is not required as no additional "
898
901
  "Python libraries are required or all required libraries for "
899
902
  "your code are pre-installed.", Logging.Level.WARNING)
903
+ with open(requirements_file_path, 'w') as file:
904
+ file.write("")
905
+
900
906
 
901
907
  if is_deploy: print_library_log("Successful validation of requirements.txt")
902
908
 
@@ -917,20 +923,21 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
917
923
  "#workingwithrequirementstxtfile", Logging.Level.SEVERE)
918
924
  print(*list(missing_deps.values()))
919
925
 
920
- def load_or_add_requirements_file(self, project_path):
921
- if os.path.exists(REQUIREMENTS_TXT):
922
- requirements = self.fetch_requirements_as_dict(self, os.path.join(project_path, 'requirements.txt'))
926
+ def load_or_add_requirements_file(self, requirements_file_path):
927
+ if os.path.exists(requirements_file_path):
928
+ requirements = self.fetch_requirements_as_dict(self, requirements_file_path)
923
929
  else:
924
- with open(REQUIREMENTS_TXT, 'w', encoding=UTF_8):
930
+ with open(requirements_file_path, 'w', encoding=UTF_8):
925
931
  pass
926
932
  requirements = {}
927
933
  print_library_log("Adding `requirements.txt` file to your project folder.", Logging.Level.WARNING)
928
934
  return requirements
929
935
 
930
936
  def copy_requirements_file_to_tmp_requirements_file(self, requirements_file_path: str, tmp_requirements_file_path):
931
- requirements_file_content = self.fetch_requirements_from_file(requirements_file_path)
932
- with open(tmp_requirements_file_path, 'w') as file:
933
- file.write("\n".join(requirements_file_content))
937
+ if os.path.exists(requirements_file_path):
938
+ requirements_file_content = self.fetch_requirements_from_file(requirements_file_path)
939
+ with open(tmp_requirements_file_path, 'w') as file:
940
+ file.write("\n".join(requirements_file_content))
934
941
 
935
942
  @staticmethod
936
943
  def remove_unwanted_packages(requirements: dict):
@@ -1531,7 +1538,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1531
1538
  Yields:
1532
1539
  str: Each line from the stream after replacing the matched pattern with the replacement string.
1533
1540
  """
1534
- pattern = r'com\.fivetran\.fivetran_sdk.*\.tools\.testers\.\S+'
1541
+ pattern = r'com\.fivetran\.partner_sdk.*\.tools\.testers\.\S+'
1535
1542
 
1536
1543
  for line in iter(stream.readline, ""):
1537
1544
  if not re.search(pattern, line):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fivetran_connector_sdk
3
- Version: 1.4.0
3
+ Version: 1.4.2
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=XmMD2PWvCluKqy9d039Yz70yHPdcsxS-VVl8LSoHoJ8,86068
1
+ fivetran_connector_sdk/__init__.py,sha256=oMjwNTcHQ1SM_MYWplGEvYmNzElrQ4k4EQUDhwflIi0,86407
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.4.0.dist-info/METADATA,sha256=KQFMWlJTNKgNiDiO-SGmhvP5G1R1THHZukL60RiB23E,2967
10
- fivetran_connector_sdk-1.4.0.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
11
- fivetran_connector_sdk-1.4.0.dist-info/entry_points.txt,sha256=uQn0KPnFlQmXJfxlk0tifdNsSXWfVlnAFzNqjXZM_xM,57
12
- fivetran_connector_sdk-1.4.0.dist-info/top_level.txt,sha256=-_xk2MFY4psIh7jw1lJePMzFb5-vask8_ZtX-UzYWUI,23
13
- fivetran_connector_sdk-1.4.0.dist-info/RECORD,,
9
+ fivetran_connector_sdk-1.4.2.dist-info/METADATA,sha256=AMqTsLXbX7InDr7tcOXQBTyjJKB7WAXURYGbhhoKTB8,2967
10
+ fivetran_connector_sdk-1.4.2.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
11
+ fivetran_connector_sdk-1.4.2.dist-info/entry_points.txt,sha256=uQn0KPnFlQmXJfxlk0tifdNsSXWfVlnAFzNqjXZM_xM,57
12
+ fivetran_connector_sdk-1.4.2.dist-info/top_level.txt,sha256=-_xk2MFY4psIh7jw1lJePMzFb5-vask8_ZtX-UzYWUI,23
13
+ fivetran_connector_sdk-1.4.2.dist-info/RECORD,,