fivetran-connector-sdk 0.13.30.1__tar.gz → 1.1.2__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.
Files changed (18) hide show
  1. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/PKG-INFO +1 -1
  2. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/__init__.py +28 -12
  3. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk.egg-info/PKG-INFO +1 -1
  4. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/README.md +0 -0
  5. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/pyproject.toml +0 -0
  6. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/setup.cfg +0 -0
  7. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/__init__.py +0 -0
  8. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/common_pb2.py +0 -0
  9. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/common_pb2.pyi +0 -0
  10. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/common_pb2_grpc.py +0 -0
  11. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.py +0 -0
  12. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.pyi +0 -0
  13. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/connector_sdk_pb2_grpc.py +0 -0
  14. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk.egg-info/SOURCES.txt +0 -0
  15. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk.egg-info/dependency_links.txt +0 -0
  16. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk.egg-info/entry_points.txt +0 -0
  17. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk.egg-info/requires.txt +0 -0
  18. {fivetran_connector_sdk-0.13.30.1 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: fivetran_connector_sdk
3
- Version: 0.13.30.1
3
+ Version: 1.1.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
@@ -28,8 +28,9 @@ from fivetran_connector_sdk.protos import common_pb2
28
28
  from fivetran_connector_sdk.protos import connector_sdk_pb2
29
29
  from fivetran_connector_sdk.protos import connector_sdk_pb2_grpc
30
30
 
31
- # Version format: <major_version>.<MM>.<DD>.<iteration> (where MM is incremental value from Jan 2024)
32
- __version__ = "0.13.30.1"
31
+ # Version format: <major_version>.<minor_version>.<patch_version>
32
+ # (where Major Version = 1 for GA, Minor Version is incremental MM from Jan 25 onwards, Patch Version is incremental within a month)
33
+ __version__ = "1.1.2"
33
34
 
34
35
  MAC_OS = "mac"
35
36
  WIN_OS = "windows"
@@ -76,6 +77,8 @@ DRIVERS = "drivers"
76
77
  JAVA_LONG_MAX_VALUE = 9223372036854775807
77
78
  MAX_CONFIG_FIELDS = 100
78
79
  SUPPORTED_PYTHON_VERSIONS = {"3.12.8", "3.11.11", "3.10.16", "3.9.21"}
80
+ DEFAULT_PYTHON_VERSION = "3.12.8"
81
+ FIVETRAN_HD_AGENT_ID = "FIVETRAN_HD_AGENT_ID"
79
82
 
80
83
 
81
84
  class Logging:
@@ -706,7 +709,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
706
709
  continue
707
710
  try:
708
711
  key = re.split(r"==|>=|<=|>|<", requirement)[0]
709
- requirements_dict[key.lower()] = requirement.lower()
712
+ requirements_dict[key.lower().replace('-', '_')] = requirement.lower()
710
713
  except ValueError:
711
714
  print_library_log(f"Invalid requirement format: '{requirement}'", Logging.Level.SEVERE)
712
715
  return requirements_dict
@@ -831,7 +834,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
831
834
  return requirements
832
835
 
833
836
  # Call this method to deploy the connector to Fivetran platform
834
- def deploy(self, args: dict, deploy_key: str, group: str, connection: str, configuration: dict = None):
837
+ def deploy(self, args: dict, deploy_key: str, group: str, connection: str, hd_agent_id: str, configuration: dict = None):
835
838
  """Deploys the connector to the Fivetran platform.
836
839
 
837
840
  Args:
@@ -839,6 +842,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
839
842
  deploy_key (str): The deployment key.
840
843
  group (str): The group name.
841
844
  connection (str): The connection name.
845
+ hd_agent_id (str): The hybrid deployment agent ID within the Fivetran system.
842
846
  configuration (dict): The configuration dictionary.
843
847
  """
844
848
  global EXECUTED_VIA_CLI
@@ -880,6 +884,8 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
880
884
  else:
881
885
  if args.force:
882
886
  confirm = "y"
887
+ if args.configuration:
888
+ confirm_config = "y"
883
889
  else:
884
890
  confirm = input(
885
891
  f"The connection '{connection}' already exists in the destination '{group}'. Updating it will overwrite the existing code. Do you want to proceed with the update? (Y/N): ")
@@ -890,7 +896,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
890
896
  self.__upload_project(
891
897
  args.project_path, deploy_key, group_id, group_name, connection)
892
898
  self.__update_connection(
893
- args, connection_id, connection, group_name, connection_config, deploy_key)
899
+ args, connection_id, connection, group_name, connection_config, deploy_key, hd_agent_id)
894
900
  print("✓")
895
901
  print_library_log(f"Connector ID: {connection_id}")
896
902
  print_library_log(
@@ -902,11 +908,13 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
902
908
  self.__upload_project(args.project_path, deploy_key,
903
909
  group_id, group_name, connection)
904
910
  response = self.__create_connection(
905
- deploy_key, group_id, connection_config)
911
+ deploy_key, group_id, connection_config, hd_agent_id)
906
912
  if response.ok:
907
913
  print_library_log(
908
914
  f"The connection '{connection}' has been created successfully.\n")
909
915
  connection_id = response.json()['data']['id']
916
+ # Python Version is not passed into connection_config as default value will be picked up from ConnectorSdkCredentials.java class.
917
+ print_library_log(f"Python Version: {args.python_version if args.python_version else DEFAULT_PYTHON_VERSION}", Logging.Level.INFO)
910
918
  print_library_log(f"Connector ID: {connection_id}")
911
919
  print_library_log(
912
920
  f"Visit the Fivetran dashboard to start the initial sync: https://fivetran.com/dashboard/connectors/{connection_id}/status")
@@ -933,7 +941,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
933
941
  os._exit(1)
934
942
 
935
943
  @staticmethod
936
- def __update_connection(args: dict, id: str, name: str, group: str, config: dict, deploy_key: str):
944
+ def __update_connection(args: dict, id: str, name: str, group: str, config: dict, deploy_key: str, hd_agent_id: str):
937
945
  """Updates the connection with the given ID, name, group, configuration, and deployment key.
938
946
 
939
947
  Args:
@@ -943,6 +951,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
943
951
  group (str): The group name.
944
952
  config (dict): The configuration dictionary.
945
953
  deploy_key (str): The deployment key.
954
+ hd_agent_id (str): The hybrid deployment agent ID within the Fivetran system.
946
955
  """
947
956
  if not args.configuration:
948
957
  del config["secrets_list"]
@@ -951,6 +960,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
951
960
  headers={"Authorization": f"Basic {deploy_key}"},
952
961
  json={
953
962
  "config": config,
963
+ "hybrid_deployment_agent_id": hd_agent_id,
954
964
  "run_setup_tests": True
955
965
  })
956
966
 
@@ -986,13 +996,14 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
986
996
  return None
987
997
 
988
998
  @staticmethod
989
- def __create_connection(deploy_key: str, group_id: str, config: dict) -> rq.Response:
999
+ def __create_connection(deploy_key: str, group_id: str, config: dict, hd_agent_id: str) -> rq.Response:
990
1000
  """Creates a new connection with the given deployment key, group ID, and configuration.
991
1001
 
992
1002
  Args:
993
1003
  deploy_key (str): The deployment key.
994
1004
  group_id (str): The group ID.
995
1005
  config (dict): The configuration dictionary.
1006
+ hd_agent_id (str): The hybrid deployment agent ID within the Fivetran system.
996
1007
 
997
1008
  Returns:
998
1009
  rq.Response: The response object.
@@ -1006,6 +1017,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1006
1017
  "paused": True,
1007
1018
  "run_setup_tests": True,
1008
1019
  "sync_frequency": "360",
1020
+ "hybrid_deployment_agent_id": hd_agent_id
1009
1021
  })
1010
1022
  return response
1011
1023
 
@@ -1443,6 +1455,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1443
1455
  connector_sdk_pb2.SchemaResponse: The schema response.
1444
1456
  """
1445
1457
  global TABLES
1458
+ table_list = {}
1446
1459
 
1447
1460
  if not self.schema_method:
1448
1461
  return connector_sdk_pb2.SchemaResponse(schema_response_not_supported=True)
@@ -1451,7 +1464,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1451
1464
  configuration = self.configuration if self.configuration else request.configuration
1452
1465
  print_library_log("Initiating the 'schema' method call...", Logging.Level.INFO)
1453
1466
  response = self.schema_method(configuration)
1454
- self.process_tables(response)
1467
+ self.process_tables(response, table_list)
1455
1468
  return connector_sdk_pb2.SchemaResponse(without_schema=common_pb2.TableList(tables=TABLES.values()))
1456
1469
 
1457
1470
  except Exception as e:
@@ -1460,14 +1473,14 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1460
1473
  print_library_log(error_message, Logging.Level.SEVERE)
1461
1474
  raise RuntimeError(error_message) from e
1462
1475
 
1463
- def process_tables(self, response):
1476
+ def process_tables(self, response, table_list):
1464
1477
  for entry in response:
1465
1478
  if 'table' not in entry:
1466
1479
  raise ValueError("Entry missing table name: " + entry)
1467
1480
 
1468
1481
  table_name = get_renamed_table_name(entry['table'])
1469
1482
 
1470
- if table_name in TABLES:
1483
+ if table_name in table_list:
1471
1484
  raise ValueError("Table already defined: " + table_name)
1472
1485
 
1473
1486
  table = common_pb2.Table(name=table_name)
@@ -1481,6 +1494,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1481
1494
 
1482
1495
  table.columns.extend(columns.values())
1483
1496
  TABLES[table_name] = table
1497
+ table_list[table_name] = table
1484
1498
 
1485
1499
  def process_primary_keys(self, columns, entry):
1486
1500
  for pkey_name in entry["primary_key"]:
@@ -1690,6 +1704,7 @@ def main():
1690
1704
  parser.add_argument("--connection", type=str, default=None, help="Connection name (aka 'destination schema')")
1691
1705
  parser.add_argument("-f", "--force", action="store_true", help="Force update an existing connection")
1692
1706
  parser.add_argument("--python-version", "--python", type=str, help=f"Supported Python versions you can use: {SUPPORTED_PYTHON_VERSIONS}. Defaults to 3.12.8")
1707
+ parser.add_argument("--hybrid-deployment-agent-id", type=str, help=argparse.SUPPRESS)
1693
1708
 
1694
1709
  args = parser.parse_args()
1695
1710
 
@@ -1709,6 +1724,7 @@ def main():
1709
1724
  ft_group = args.destination if args.destination else os.getenv('FIVETRAN_DESTINATION_NAME', None)
1710
1725
  ft_connection = args.connection if args.connection else os.getenv('FIVETRAN_CONNECTION_NAME', None)
1711
1726
  ft_deploy_key = args.api_key if args.api_key else os.getenv('FIVETRAN_API_KEY', None)
1727
+ hd_agent_id = args.hybrid_deployment_agent_id if args.hybrid_deployment_agent_id else os.getenv(FIVETRAN_HD_AGENT_ID, None)
1712
1728
  configuration = args.configuration if args.configuration else None
1713
1729
  state = args.state if args.state else os.getenv('FIVETRAN_STATE', None)
1714
1730
 
@@ -1718,7 +1734,7 @@ def main():
1718
1734
  if args.command.lower() == "deploy":
1719
1735
  if args.state:
1720
1736
  print_library_log("'state' parameter is not used for 'deploy' command", Logging.Level.WARNING)
1721
- connector_object.deploy(args, ft_deploy_key, ft_group, ft_connection, configuration)
1737
+ connector_object.deploy(args, ft_deploy_key, ft_group, ft_connection, hd_agent_id, configuration)
1722
1738
 
1723
1739
  elif args.command.lower() == "debug":
1724
1740
  connector_object.debug(args.project_path, configuration, state)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: fivetran_connector_sdk
3
- Version: 0.13.30.1
3
+ Version: 1.1.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