fivetran-connector-sdk 0.8.19.1__py3-none-any.whl → 0.8.21.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 +59 -30
- fivetran_connector_sdk-0.8.21.1.dist-info/METADATA +57 -0
- {fivetran_connector_sdk-0.8.19.1.dist-info → fivetran_connector_sdk-0.8.21.1.dist-info}/RECORD +6 -6
- {fivetran_connector_sdk-0.8.19.1.dist-info → fivetran_connector_sdk-0.8.21.1.dist-info}/WHEEL +1 -1
- fivetran_connector_sdk-0.8.19.1.dist-info/METADATA +0 -18
- {fivetran_connector_sdk-0.8.19.1.dist-info → fivetran_connector_sdk-0.8.21.1.dist-info}/entry_points.txt +0 -0
- {fivetran_connector_sdk-0.8.19.1.dist-info → fivetran_connector_sdk-0.8.21.1.dist-info}/top_level.txt +0 -0
@@ -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.
|
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=
|
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
|
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
|
-
|
778
|
-
|
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(
|
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
|
-
|
785
|
-
groups =
|
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
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
print(
|
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
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
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"
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
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
|
+
|
{fivetran_connector_sdk-0.8.19.1.dist-info → fivetran_connector_sdk-0.8.21.1.dist-info}/RECORD
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
fivetran_connector_sdk/__init__.py,sha256=
|
1
|
+
fivetran_connector_sdk/__init__.py,sha256=1zgYuvadYRzaGcp0kG_icP55qS0lD_gRQhj3LzbI3X8,51084
|
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-0.8.
|
10
|
-
fivetran_connector_sdk-0.8.
|
11
|
-
fivetran_connector_sdk-0.8.
|
12
|
-
fivetran_connector_sdk-0.8.
|
13
|
-
fivetran_connector_sdk-0.8.
|
9
|
+
fivetran_connector_sdk-0.8.21.1.dist-info/METADATA,sha256=jbJsixFXfw57UlFrRvPBGiiu6x4k4-Mx1wCsRaqzgU0,2796
|
10
|
+
fivetran_connector_sdk-0.8.21.1.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
11
|
+
fivetran_connector_sdk-0.8.21.1.dist-info/entry_points.txt,sha256=uQn0KPnFlQmXJfxlk0tifdNsSXWfVlnAFzNqjXZM_xM,57
|
12
|
+
fivetran_connector_sdk-0.8.21.1.dist-info/top_level.txt,sha256=-_xk2MFY4psIh7jw1lJePMzFb5-vask8_ZtX-UzYWUI,23
|
13
|
+
fivetran_connector_sdk-0.8.21.1.dist-info/RECORD,,
|
@@ -1,18 +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
|
18
|
-
|
File without changes
|
File without changes
|