fivetran-connector-sdk 0.8.19.1__tar.gz → 0.8.21.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.
Files changed (20) hide show
  1. fivetran_connector_sdk-0.8.21.1/PKG-INFO +57 -0
  2. fivetran_connector_sdk-0.8.21.1/README.md +39 -0
  3. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk/__init__.py +59 -30
  4. fivetran_connector_sdk-0.8.21.1/src/fivetran_connector_sdk.egg-info/PKG-INFO +57 -0
  5. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk.egg-info/SOURCES.txt +1 -0
  6. fivetran_connector_sdk-0.8.19.1/PKG-INFO +0 -17
  7. fivetran_connector_sdk-0.8.19.1/src/fivetran_connector_sdk.egg-info/PKG-INFO +0 -17
  8. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/pyproject.toml +0 -0
  9. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/setup.cfg +0 -0
  10. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk/protos/__init__.py +0 -0
  11. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk/protos/common_pb2.py +0 -0
  12. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk/protos/common_pb2.pyi +0 -0
  13. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk/protos/common_pb2_grpc.py +0 -0
  14. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.py +0 -0
  15. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.pyi +0 -0
  16. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk/protos/connector_sdk_pb2_grpc.py +0 -0
  17. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk.egg-info/dependency_links.txt +0 -0
  18. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk.egg-info/entry_points.txt +0 -0
  19. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk.egg-info/requires.txt +0 -0
  20. {fivetran_connector_sdk-0.8.19.1 → fivetran_connector_sdk-0.8.21.1}/src/fivetran_connector_sdk.egg-info/top_level.txt +0 -0
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.1
2
+ Name: fivetran_connector_sdk
3
+ Version: 0.8.21.1
4
+ Summary: Build custom connectors on Fivetran platform
5
+ Author-email: Fivetran <developers@fivetran.com>
6
+ Project-URL: Homepage, https://fivetran.com/docs/connectors/connector-sdk
7
+ Project-URL: Github, https://github.com/fivetran/fivetran_connector_sdk
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: grpcio==1.60.1
14
+ Requires-Dist: grpcio-tools==1.60.1
15
+ Requires-Dist: requests==2.31.0
16
+ Requires-Dist: get_pypi_latest_version==0.0.12
17
+ Requires-Dist: pipreqs==0.5.0
18
+
19
+ # **fivetran-connector-sdk**
20
+ The *fivetran-connector-sdk* is a Python module that enables you to write custom data connectors and deploy them as an extension of [Fivetran](https://www.fivetran.com/). Fivetran automatically manages running the connectors on your scheduled frequency and manages the required compute resources.
21
+
22
+ The Connector SDK service is the best fit for the following use cases:
23
+ - Fivetran doesn't have a connector for your source and is unlikely to support it soon.
24
+ - You are using private APIs, custom applications, unsupported file formats, or those that require pre-processing.
25
+ - You have sensitive data that needs filtering or anonymizing before entering the destination.
26
+ - You don't want to introduce a 3rd party into your pipeline (e.g., to host a custom function).
27
+
28
+ To learn more, see our [Connector SDK documentation](https://fivetran.com/docs/connectors/connector-sdk)
29
+
30
+ ## **Install**
31
+
32
+ pip install fivetran-connector-sdk
33
+
34
+ ## **Requirements**
35
+ - Python ≥3.9 and ≤3.12
36
+ - Operating System:
37
+ - Windows 10 or later
38
+ - MacOS 13 (Ventura) or later
39
+
40
+ ## **Getting started**
41
+ See [Quickstart guide](https://fivetran.com/docs/connectors/connector-sdk/quickstart-guide) to get started.
42
+
43
+ ## **Usage**
44
+ Import required classes from fivetran_connector_sdk to begin writing your custom data connector
45
+
46
+ ```python
47
+ from fivetran_connector_sdk import Connector
48
+ from fivetran_connector_sdk import Logging as log
49
+ from fivetran_connector_sdk import Operations as op
50
+ ```
51
+ See our [Technical Reference](https://fivetran.com/docs/connectors/connector-sdk/technical-reference#update) and [Best Practices](https://fivetran.com/docs/connectors/connector-sdk/best-practices) documentation for more details.
52
+
53
+ You can also refer to our [existing examples](https://github.com/fivetran/fivetran_connector_sdk) to better understand Fivetran's Connector SDK and start creating custom data connectors.
54
+
55
+ ## **Maintenance**
56
+ This package is actively maintained by Fivetran Developers. Please reach out to our [Support team](https://support.fivetran.com/hc/en-us) for any inquiries.
57
+
@@ -0,0 +1,39 @@
1
+ # **fivetran-connector-sdk**
2
+ The *fivetran-connector-sdk* is a Python module that enables you to write custom data connectors and deploy them as an extension of [Fivetran](https://www.fivetran.com/). Fivetran automatically manages running the connectors on your scheduled frequency and manages the required compute resources.
3
+
4
+ The Connector SDK service is the best fit for the following use cases:
5
+ - Fivetran doesn't have a connector for your source and is unlikely to support it soon.
6
+ - You are using private APIs, custom applications, unsupported file formats, or those that require pre-processing.
7
+ - You have sensitive data that needs filtering or anonymizing before entering the destination.
8
+ - You don't want to introduce a 3rd party into your pipeline (e.g., to host a custom function).
9
+
10
+ To learn more, see our [Connector SDK documentation](https://fivetran.com/docs/connectors/connector-sdk)
11
+
12
+ ## **Install**
13
+
14
+ pip install fivetran-connector-sdk
15
+
16
+ ## **Requirements**
17
+ - Python ≥3.9 and ≤3.12
18
+ - Operating System:
19
+ - Windows 10 or later
20
+ - MacOS 13 (Ventura) or later
21
+
22
+ ## **Getting started**
23
+ See [Quickstart guide](https://fivetran.com/docs/connectors/connector-sdk/quickstart-guide) to get started.
24
+
25
+ ## **Usage**
26
+ Import required classes from fivetran_connector_sdk to begin writing your custom data connector
27
+
28
+ ```python
29
+ from fivetran_connector_sdk import Connector
30
+ from fivetran_connector_sdk import Logging as log
31
+ from fivetran_connector_sdk import Operations as op
32
+ ```
33
+ See our [Technical Reference](https://fivetran.com/docs/connectors/connector-sdk/technical-reference#update) and [Best Practices](https://fivetran.com/docs/connectors/connector-sdk/best-practices) documentation for more details.
34
+
35
+ You can also refer to our [existing examples](https://github.com/fivetran/fivetran_connector_sdk) to better understand Fivetran's Connector SDK and start creating custom data connectors.
36
+
37
+ ## **Maintenance**
38
+ This package is actively maintained by Fivetran Developers. Please reach out to our [Support team](https://support.fivetran.com/hc/en-us) for any inquiries.
39
+
@@ -23,7 +23,7 @@ from fivetran_connector_sdk.protos import common_pb2
23
23
  from fivetran_connector_sdk.protos import connector_sdk_pb2
24
24
  from fivetran_connector_sdk.protos import connector_sdk_pb2_grpc
25
25
 
26
- __version__ = "0.8.19.1"
26
+ __version__ = "0.8.21.1"
27
27
 
28
28
  MAC_OS = "mac"
29
29
  WIN_OS = "windows"
@@ -129,9 +129,8 @@ class Operations:
129
129
  global TABLES
130
130
  for field in data.keys():
131
131
  columns[field] = common_pb2.Column(
132
- name=field, type=common_pb2.DataType.UNSPECIFIED, primary_key=True)
132
+ name=field, type=common_pb2.DataType.UNSPECIFIED, primary_key=False)
133
133
  new_table = common_pb2.Table(name=table, columns=columns.values())
134
- TABLES[table] = new_table
135
134
 
136
135
  responses.append(connector_sdk_pb2.UpdateResponse(
137
136
  operation=connector_sdk_pb2.Operation(
@@ -510,7 +509,8 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
510
509
 
511
510
  unused_deps = list(requirements.keys() - tmp_requirements.keys())
512
511
  if unused_deps:
513
- print("INFO: The following dependencies are not used in connector.py:")
512
+ print("INFO: The following dependencies are not needed, "
513
+ "they are not used or already installed. Please remove them from requirements.txt:")
514
514
  print(*unused_deps)
515
515
  else:
516
516
  if os.path.exists("requirements.txt"):
@@ -532,7 +532,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
532
532
  """
533
533
  if not deploy_key: print("SEVERE: The Fivetran API key is missing. Please provide a valid Fivetran API key to create the connector."); os._exit(1)
534
534
  if not connection: print("SEVERE: The connection name is missing. Please provide a valid connection name to create the connector."); os._exit(1)
535
- _check_dict(configuration)
535
+ _check_dict(configuration, True)
536
536
 
537
537
  secrets_list = []
538
538
  if configuration:
@@ -774,31 +774,48 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
774
774
  Returns:
775
775
  tuple[str, str]: A tuple containing the group ID and group name.
776
776
  """
777
- resp = rq.get("https://api.fivetran.com/v1/groups",
778
- headers={"Authorization": f"Basic {deploy_key}"})
777
+ groups_url = "https://api.fivetran.com/v1/groups"
778
+
779
+ params = {"limit": 500}
780
+ headers = {"Authorization": f"Basic {deploy_key}"}
781
+ resp = rq.get(groups_url, headers=headers, params=params)
779
782
 
780
783
  if not resp.ok:
781
- print(f"SEVERE: Unable to fetch list of destination names, status code = {resp.status_code}")
784
+ print(
785
+ f"SEVERE: Unable to fetch list of destination names, status code = {resp.status_code}")
782
786
  os._exit(1)
783
787
 
784
- # TODO: Do we need to implement pagination?
785
- groups = resp.json()['data']['items']
788
+ data = resp.json().get("data", {})
789
+ groups = data.get("items")
790
+
786
791
  if not groups:
787
792
  print("SEVERE: No destinations defined in the account")
788
793
  os._exit(1)
789
794
 
790
- if len(groups) == 1:
791
- return groups[0]['id'], groups[0]['name']
792
- else:
793
- if not group:
794
- print("SEVERE: Destination name is required when there are multiple destinations in the account")
795
+ if not group:
796
+ if len(groups) == 1:
797
+ return groups[0]['id'], groups[0]['name']
798
+ else:
799
+ print(
800
+ "SEVERE: Destination name is required when there are multiple destinations in the account")
795
801
  os._exit(1)
796
-
797
- for grp in groups:
798
- if grp['name'] == group:
799
- return grp['id'], grp['name']
800
-
801
- print(f"SEVERE: Specified destination was not found in the account: {group}")
802
+ else:
803
+ while True:
804
+ for grp in groups:
805
+ if grp['name'] == group:
806
+ return grp['id'], grp['name']
807
+
808
+ next_cursor = data.get("next_cursor")
809
+ if not next_cursor:
810
+ break
811
+
812
+ params = {"cursor": next_cursor, "limit": 500}
813
+ resp = rq.get(groups_url, headers=headers, params=params)
814
+ data = resp.json().get("data", {})
815
+ groups = data.get("items", [])
816
+
817
+ print(
818
+ f"SEVERE: The specified destination '{group}' was not found in your account.")
802
819
  os._exit(1)
803
820
 
804
821
  # Call this method to run the connector in production
@@ -1056,13 +1073,11 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1056
1073
  table = common_pb2.Table(name=table_name)
1057
1074
  columns = {}
1058
1075
 
1059
- if "primary_key" not in entry:
1060
- ValueError("Table requires at least one primary key: " + table_name)
1061
-
1062
- for pkey_name in entry["primary_key"]:
1063
- column = columns[pkey_name] if pkey_name in columns else common_pb2.Column(name=pkey_name)
1064
- column.primary_key = True
1065
- columns[pkey_name] = column
1076
+ if "primary_key" in entry:
1077
+ for pkey_name in entry["primary_key"]:
1078
+ column = columns[pkey_name] if pkey_name in columns else common_pb2.Column(name=pkey_name)
1079
+ column.primary_key = True
1080
+ columns[pkey_name] = column
1066
1081
 
1067
1082
  if "columns" in entry:
1068
1083
  for name, type in entry["columns"].items():
@@ -1110,7 +1125,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
1110
1125
  else:
1111
1126
  raise ValueError("Unrecognized column type: ", str(type))
1112
1127
 
1113
- if name in entry["primary_key"]:
1128
+ if "primary_key" in entry and name in entry["primary_key"]:
1114
1129
  column.primary_key = True
1115
1130
 
1116
1131
  columns[name] = column
@@ -1179,7 +1194,7 @@ def main():
1179
1194
  parser = argparse.ArgumentParser(allow_abbrev=False)
1180
1195
 
1181
1196
  # Positional
1182
- parser.add_argument("command", help="debug|deploy")
1197
+ parser.add_argument("command", help="debug|deploy|reset")
1183
1198
  parser.add_argument("project_path", nargs='?', default=os.getcwd(), help="Path to connector project directory")
1184
1199
 
1185
1200
  # Optional (Not all of these are valid with every mutually exclusive option below)
@@ -1232,6 +1247,20 @@ def main():
1232
1247
  port = 50051 if not args.port else args.port
1233
1248
  connector_object.debug(args.project_path, port, configuration, state)
1234
1249
 
1250
+ elif args.command.lower() == "reset":
1251
+ files_path = os.path.join(args.project_path, OUTPUT_FILES_DIR)
1252
+ confirm = input("This will delete your current state and `warehouse.db` files. Do you want to continue? (Y/N): ")
1253
+ if confirm.lower() != "y":
1254
+ print("INFO: Reset canceled")
1255
+ else:
1256
+ try:
1257
+ if os.path.exists(files_path) and os.path.isdir(files_path):
1258
+ shutil.rmtree(files_path)
1259
+ print("INFO: Reset Successful")
1260
+ except Exception as e:
1261
+ print("ERROR: Reset Failed")
1262
+ raise e
1263
+
1235
1264
  else:
1236
1265
  raise NotImplementedError("Invalid command: ", args.command)
1237
1266
 
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.1
2
+ Name: fivetran_connector_sdk
3
+ Version: 0.8.21.1
4
+ Summary: Build custom connectors on Fivetran platform
5
+ Author-email: Fivetran <developers@fivetran.com>
6
+ Project-URL: Homepage, https://fivetran.com/docs/connectors/connector-sdk
7
+ Project-URL: Github, https://github.com/fivetran/fivetran_connector_sdk
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: grpcio==1.60.1
14
+ Requires-Dist: grpcio-tools==1.60.1
15
+ Requires-Dist: requests==2.31.0
16
+ Requires-Dist: get_pypi_latest_version==0.0.12
17
+ Requires-Dist: pipreqs==0.5.0
18
+
19
+ # **fivetran-connector-sdk**
20
+ The *fivetran-connector-sdk* is a Python module that enables you to write custom data connectors and deploy them as an extension of [Fivetran](https://www.fivetran.com/). Fivetran automatically manages running the connectors on your scheduled frequency and manages the required compute resources.
21
+
22
+ The Connector SDK service is the best fit for the following use cases:
23
+ - Fivetran doesn't have a connector for your source and is unlikely to support it soon.
24
+ - You are using private APIs, custom applications, unsupported file formats, or those that require pre-processing.
25
+ - You have sensitive data that needs filtering or anonymizing before entering the destination.
26
+ - You don't want to introduce a 3rd party into your pipeline (e.g., to host a custom function).
27
+
28
+ To learn more, see our [Connector SDK documentation](https://fivetran.com/docs/connectors/connector-sdk)
29
+
30
+ ## **Install**
31
+
32
+ pip install fivetran-connector-sdk
33
+
34
+ ## **Requirements**
35
+ - Python ≥3.9 and ≤3.12
36
+ - Operating System:
37
+ - Windows 10 or later
38
+ - MacOS 13 (Ventura) or later
39
+
40
+ ## **Getting started**
41
+ See [Quickstart guide](https://fivetran.com/docs/connectors/connector-sdk/quickstart-guide) to get started.
42
+
43
+ ## **Usage**
44
+ Import required classes from fivetran_connector_sdk to begin writing your custom data connector
45
+
46
+ ```python
47
+ from fivetran_connector_sdk import Connector
48
+ from fivetran_connector_sdk import Logging as log
49
+ from fivetran_connector_sdk import Operations as op
50
+ ```
51
+ See our [Technical Reference](https://fivetran.com/docs/connectors/connector-sdk/technical-reference#update) and [Best Practices](https://fivetran.com/docs/connectors/connector-sdk/best-practices) documentation for more details.
52
+
53
+ You can also refer to our [existing examples](https://github.com/fivetran/fivetran_connector_sdk) to better understand Fivetran's Connector SDK and start creating custom data connectors.
54
+
55
+ ## **Maintenance**
56
+ This package is actively maintained by Fivetran Developers. Please reach out to our [Support team](https://support.fivetran.com/hc/en-us) for any inquiries.
57
+
@@ -1,3 +1,4 @@
1
+ README.md
1
2
  pyproject.toml
2
3
  src/fivetran_connector_sdk/__init__.py
3
4
  src/fivetran_connector_sdk.egg-info/PKG-INFO
@@ -1,17 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: fivetran_connector_sdk
3
- Version: 0.8.19.1
4
- Summary: Build custom connectors on Fivetran platform
5
- Author-email: Fivetran <developers@fivetran.com>
6
- Project-URL: Homepage, https://fivetran.com/docs/connectors/connector-sdk
7
- Project-URL: Github, https://github.com/fivetran/fivetran_connector_sdk
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.9
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: grpcio==1.60.1
14
- Requires-Dist: grpcio-tools==1.60.1
15
- Requires-Dist: requests==2.31.0
16
- Requires-Dist: get_pypi_latest_version==0.0.12
17
- Requires-Dist: pipreqs==0.5.0
@@ -1,17 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: fivetran_connector_sdk
3
- Version: 0.8.19.1
4
- Summary: Build custom connectors on Fivetran platform
5
- Author-email: Fivetran <developers@fivetran.com>
6
- Project-URL: Homepage, https://fivetran.com/docs/connectors/connector-sdk
7
- Project-URL: Github, https://github.com/fivetran/fivetran_connector_sdk
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.9
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: grpcio==1.60.1
14
- Requires-Dist: grpcio-tools==1.60.1
15
- Requires-Dist: requests==2.31.0
16
- Requires-Dist: get_pypi_latest_version==0.0.12
17
- Requires-Dist: pipreqs==0.5.0