fivetran-connector-sdk 1.0.0__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-1.0.0 → fivetran_connector_sdk-1.1.2}/PKG-INFO +1 -1
  2. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/__init__.py +21 -11
  3. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk.egg-info/PKG-INFO +1 -1
  4. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/README.md +0 -0
  5. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/pyproject.toml +0 -0
  6. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/setup.cfg +0 -0
  7. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/__init__.py +0 -0
  8. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/common_pb2.py +0 -0
  9. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/common_pb2.pyi +0 -0
  10. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/common_pb2_grpc.py +0 -0
  11. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.py +0 -0
  12. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.pyi +0 -0
  13. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk/protos/connector_sdk_pb2_grpc.py +0 -0
  14. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk.egg-info/SOURCES.txt +0 -0
  15. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk.egg-info/dependency_links.txt +0 -0
  16. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk.egg-info/entry_points.txt +0 -0
  17. {fivetran_connector_sdk-1.0.0 → fivetran_connector_sdk-1.1.2}/src/fivetran_connector_sdk.egg-info/requires.txt +0 -0
  18. {fivetran_connector_sdk-1.0.0 → 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: 1.0.0
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
@@ -30,7 +30,7 @@ from fivetran_connector_sdk.protos import connector_sdk_pb2_grpc
30
30
 
31
31
  # Version format: <major_version>.<minor_version>.<patch_version>
32
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.0.0"
33
+ __version__ = "1.1.2"
34
34
 
35
35
  MAC_OS = "mac"
36
36
  WIN_OS = "windows"
@@ -78,6 +78,7 @@ JAVA_LONG_MAX_VALUE = 9223372036854775807
78
78
  MAX_CONFIG_FIELDS = 100
79
79
  SUPPORTED_PYTHON_VERSIONS = {"3.12.8", "3.11.11", "3.10.16", "3.9.21"}
80
80
  DEFAULT_PYTHON_VERSION = "3.12.8"
81
+ FIVETRAN_HD_AGENT_ID = "FIVETRAN_HD_AGENT_ID"
81
82
 
82
83
 
83
84
  class Logging:
@@ -708,7 +709,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
708
709
  continue
709
710
  try:
710
711
  key = re.split(r"==|>=|<=|>|<", requirement)[0]
711
- requirements_dict[key.lower()] = requirement.lower()
712
+ requirements_dict[key.lower().replace('-', '_')] = requirement.lower()
712
713
  except ValueError:
713
714
  print_library_log(f"Invalid requirement format: '{requirement}'", Logging.Level.SEVERE)
714
715
  return requirements_dict
@@ -833,7 +834,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
833
834
  return requirements
834
835
 
835
836
  # Call this method to deploy the connector to Fivetran platform
836
- 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):
837
838
  """Deploys the connector to the Fivetran platform.
838
839
 
839
840
  Args:
@@ -841,6 +842,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
841
842
  deploy_key (str): The deployment key.
842
843
  group (str): The group name.
843
844
  connection (str): The connection name.
845
+ hd_agent_id (str): The hybrid deployment agent ID within the Fivetran system.
844
846
  configuration (dict): The configuration dictionary.
845
847
  """
846
848
  global EXECUTED_VIA_CLI
@@ -894,7 +896,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
894
896
  self.__upload_project(
895
897
  args.project_path, deploy_key, group_id, group_name, connection)
896
898
  self.__update_connection(
897
- args, connection_id, connection, group_name, connection_config, deploy_key)
899
+ args, connection_id, connection, group_name, connection_config, deploy_key, hd_agent_id)
898
900
  print("✓")
899
901
  print_library_log(f"Connector ID: {connection_id}")
900
902
  print_library_log(
@@ -906,7 +908,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
906
908
  self.__upload_project(args.project_path, deploy_key,
907
909
  group_id, group_name, connection)
908
910
  response = self.__create_connection(
909
- deploy_key, group_id, connection_config)
911
+ deploy_key, group_id, connection_config, hd_agent_id)
910
912
  if response.ok:
911
913
  print_library_log(
912
914
  f"The connection '{connection}' has been created successfully.\n")
@@ -939,7 +941,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
939
941
  os._exit(1)
940
942
 
941
943
  @staticmethod
942
- 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):
943
945
  """Updates the connection with the given ID, name, group, configuration, and deployment key.
944
946
 
945
947
  Args:
@@ -949,6 +951,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
949
951
  group (str): The group name.
950
952
  config (dict): The configuration dictionary.
951
953
  deploy_key (str): The deployment key.
954
+ hd_agent_id (str): The hybrid deployment agent ID within the Fivetran system.
952
955
  """
953
956
  if not args.configuration:
954
957
  del config["secrets_list"]
@@ -957,6 +960,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
957
960
  headers={"Authorization": f"Basic {deploy_key}"},
958
961
  json={
959
962
  "config": config,
963
+ "hybrid_deployment_agent_id": hd_agent_id,
960
964
  "run_setup_tests": True
961
965
  })
962
966
 
@@ -992,13 +996,14 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
992
996
  return None
993
997
 
994
998
  @staticmethod
995
- 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:
996
1000
  """Creates a new connection with the given deployment key, group ID, and configuration.
997
1001
 
998
1002
  Args:
999
1003
  deploy_key (str): The deployment key.
1000
1004
  group_id (str): The group ID.
1001
1005
  config (dict): The configuration dictionary.
1006
+ hd_agent_id (str): The hybrid deployment agent ID within the Fivetran system.
1002
1007
 
1003
1008
  Returns:
1004
1009
  rq.Response: The response object.
@@ -1012,6 +1017,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1012
1017
  "paused": True,
1013
1018
  "run_setup_tests": True,
1014
1019
  "sync_frequency": "360",
1020
+ "hybrid_deployment_agent_id": hd_agent_id
1015
1021
  })
1016
1022
  return response
1017
1023
 
@@ -1449,6 +1455,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1449
1455
  connector_sdk_pb2.SchemaResponse: The schema response.
1450
1456
  """
1451
1457
  global TABLES
1458
+ table_list = {}
1452
1459
 
1453
1460
  if not self.schema_method:
1454
1461
  return connector_sdk_pb2.SchemaResponse(schema_response_not_supported=True)
@@ -1457,7 +1464,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1457
1464
  configuration = self.configuration if self.configuration else request.configuration
1458
1465
  print_library_log("Initiating the 'schema' method call...", Logging.Level.INFO)
1459
1466
  response = self.schema_method(configuration)
1460
- self.process_tables(response)
1467
+ self.process_tables(response, table_list)
1461
1468
  return connector_sdk_pb2.SchemaResponse(without_schema=common_pb2.TableList(tables=TABLES.values()))
1462
1469
 
1463
1470
  except Exception as e:
@@ -1466,14 +1473,14 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1466
1473
  print_library_log(error_message, Logging.Level.SEVERE)
1467
1474
  raise RuntimeError(error_message) from e
1468
1475
 
1469
- def process_tables(self, response):
1476
+ def process_tables(self, response, table_list):
1470
1477
  for entry in response:
1471
1478
  if 'table' not in entry:
1472
1479
  raise ValueError("Entry missing table name: " + entry)
1473
1480
 
1474
1481
  table_name = get_renamed_table_name(entry['table'])
1475
1482
 
1476
- if table_name in TABLES:
1483
+ if table_name in table_list:
1477
1484
  raise ValueError("Table already defined: " + table_name)
1478
1485
 
1479
1486
  table = common_pb2.Table(name=table_name)
@@ -1487,6 +1494,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1487
1494
 
1488
1495
  table.columns.extend(columns.values())
1489
1496
  TABLES[table_name] = table
1497
+ table_list[table_name] = table
1490
1498
 
1491
1499
  def process_primary_keys(self, columns, entry):
1492
1500
  for pkey_name in entry["primary_key"]:
@@ -1696,6 +1704,7 @@ def main():
1696
1704
  parser.add_argument("--connection", type=str, default=None, help="Connection name (aka 'destination schema')")
1697
1705
  parser.add_argument("-f", "--force", action="store_true", help="Force update an existing connection")
1698
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)
1699
1708
 
1700
1709
  args = parser.parse_args()
1701
1710
 
@@ -1715,6 +1724,7 @@ def main():
1715
1724
  ft_group = args.destination if args.destination else os.getenv('FIVETRAN_DESTINATION_NAME', None)
1716
1725
  ft_connection = args.connection if args.connection else os.getenv('FIVETRAN_CONNECTION_NAME', None)
1717
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)
1718
1728
  configuration = args.configuration if args.configuration else None
1719
1729
  state = args.state if args.state else os.getenv('FIVETRAN_STATE', None)
1720
1730
 
@@ -1724,7 +1734,7 @@ def main():
1724
1734
  if args.command.lower() == "deploy":
1725
1735
  if args.state:
1726
1736
  print_library_log("'state' parameter is not used for 'deploy' command", Logging.Level.WARNING)
1727
- 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)
1728
1738
 
1729
1739
  elif args.command.lower() == "debug":
1730
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: 1.0.0
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