fivetran-connector-sdk 1.7.4__py3-none-any.whl → 1.7.5__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 +25 -34
- fivetran_connector_sdk/constants.py +0 -1
- fivetran_connector_sdk/operations.py +5 -23
- {fivetran_connector_sdk-1.7.4.dist-info → fivetran_connector_sdk-1.7.5.dist-info}/METADATA +1 -1
- {fivetran_connector_sdk-1.7.4.dist-info → fivetran_connector_sdk-1.7.5.dist-info}/RECORD +8 -8
- {fivetran_connector_sdk-1.7.4.dist-info → fivetran_connector_sdk-1.7.5.dist-info}/WHEEL +0 -0
- {fivetran_connector_sdk-1.7.4.dist-info → fivetran_connector_sdk-1.7.5.dist-info}/entry_points.txt +0 -0
- {fivetran_connector_sdk-1.7.4.dist-info → fivetran_connector_sdk-1.7.5.dist-info}/top_level.txt +0 -0
@@ -22,8 +22,7 @@ from fivetran_connector_sdk.operations import Operations
|
|
22
22
|
from fivetran_connector_sdk import constants
|
23
23
|
from fivetran_connector_sdk.constants import (
|
24
24
|
TESTER_VER, VERSION_FILENAME, UTF_8,
|
25
|
-
VALID_COMMANDS, DEFAULT_PYTHON_VERSION, SUPPORTED_PYTHON_VERSIONS, TABLES
|
26
|
-
CONNECTOR_SDK_NO_YIELD_LABEL
|
25
|
+
VALID_COMMANDS, DEFAULT_PYTHON_VERSION, SUPPORTED_PYTHON_VERSIONS, TABLES
|
27
26
|
)
|
28
27
|
from fivetran_connector_sdk.helpers import (
|
29
28
|
print_library_log, reset_local_file_directory, find_connector_object, suggest_correct_command,
|
@@ -43,7 +42,7 @@ from fivetran_connector_sdk.connector_helper import (
|
|
43
42
|
|
44
43
|
# Version format: <major_version>.<minor_version>.<patch_version>
|
45
44
|
# (where Major Version = 1 for GA, Minor Version is incremental MM from Jan 25 onwards, Patch Version is incremental within a month)
|
46
|
-
__version__ = "1.7.
|
45
|
+
__version__ = "1.7.5"
|
47
46
|
TESTER_VERSION = TESTER_VER
|
48
47
|
MAX_MESSAGE_LENGTH = 32 * 1024 * 1024 # 32MB
|
49
48
|
|
@@ -376,42 +375,34 @@ class Connector(connector_sdk_pb2_grpc.SourceConnectorServicer):
|
|
376
375
|
try:
|
377
376
|
print_library_log("Initiating the 'update' method call...", Logging.Level.INFO)
|
378
377
|
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
for _ in result:
|
389
|
-
pass
|
390
|
-
# If the update method doesn't use yield, skip the response returned.
|
391
|
-
else:
|
378
|
+
def run_update():
|
379
|
+
try:
|
380
|
+
result = self.update_method(configuration=configuration, state=state)
|
381
|
+
# If the customer's update method returns a generator (i.e., uses yield),
|
382
|
+
# exhaust the generator responses, they are None. From this point on, all operations
|
383
|
+
# push update_response to a queue, and we yield from the queue instead.
|
384
|
+
# We return None here intentionally.
|
385
|
+
if isinstance(result, GeneratorType):
|
386
|
+
for _ in result:
|
392
387
|
pass
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
388
|
+
# If the update method doesn't use yield, skip the response returned.
|
389
|
+
else:
|
390
|
+
pass
|
391
|
+
except Exception as exc:
|
392
|
+
exception_queue.put(exc)
|
393
|
+
finally:
|
394
|
+
Operations.operation_stream.mark_done()
|
397
395
|
|
398
|
-
|
399
|
-
|
396
|
+
thread = threading.Thread(target=run_update)
|
397
|
+
thread.start()
|
400
398
|
|
401
|
-
|
399
|
+
yield from Operations.operation_stream
|
402
400
|
|
403
|
-
|
401
|
+
thread.join()
|
404
402
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
else:
|
409
|
-
for update_response in self.update_method(configuration=configuration, state=state):
|
410
|
-
if isinstance(update_response, list):
|
411
|
-
for response in update_response:
|
412
|
-
yield response
|
413
|
-
else:
|
414
|
-
yield update_response
|
403
|
+
# Check if any exception was raised during the update
|
404
|
+
if not exception_queue.empty():
|
405
|
+
raise exception_queue.get()
|
415
406
|
|
416
407
|
except TypeError as e:
|
417
408
|
if str(e) != "'NoneType' object is not iterable":
|
@@ -39,7 +39,6 @@ LOGGING_PREFIX = "Fivetran-Connector-SDK"
|
|
39
39
|
LOGGING_DELIMITER = ": "
|
40
40
|
VIRTUAL_ENV_CONFIG = "pyvenv.cfg"
|
41
41
|
ROOT_FILENAME = "connector.py"
|
42
|
-
CONNECTOR_SDK_NO_YIELD_LABEL = "CONNECTOR_SDK_NO_YIELD_APPROACH"
|
43
42
|
|
44
43
|
# Compile patterns used in the implementation
|
45
44
|
WORD_DASH_DOT_PATTERN = re.compile(r'^[\w.-]*$')
|
@@ -8,7 +8,7 @@ from google.protobuf import timestamp_pb2
|
|
8
8
|
|
9
9
|
from fivetran_connector_sdk.constants import (
|
10
10
|
JAVA_LONG_MAX_VALUE,
|
11
|
-
TABLES,
|
11
|
+
TABLES,
|
12
12
|
)
|
13
13
|
from fivetran_connector_sdk.helpers import (
|
14
14
|
get_renamed_table_name,
|
@@ -85,7 +85,6 @@ _LOG_DATA_TYPE_INFERENCE = {
|
|
85
85
|
|
86
86
|
class Operations:
|
87
87
|
operation_stream = _OperationStream()
|
88
|
-
use_no_yield_approach = os.environ.get(CONNECTOR_SDK_NO_YIELD_LABEL, "false").lower() == "true"
|
89
88
|
|
90
89
|
@staticmethod
|
91
90
|
def upsert(table: str, data: dict):
|
@@ -117,11 +116,7 @@ class Operations:
|
|
117
116
|
)
|
118
117
|
update_response = connector_sdk_pb2.UpdateResponse(record=record)
|
119
118
|
|
120
|
-
|
121
|
-
Operations.operation_stream.add(update_response)
|
122
|
-
return None
|
123
|
-
else:
|
124
|
-
return [update_response]
|
119
|
+
Operations.operation_stream.add(update_response)
|
125
120
|
|
126
121
|
|
127
122
|
@staticmethod
|
@@ -147,11 +142,7 @@ class Operations:
|
|
147
142
|
|
148
143
|
update_response = connector_sdk_pb2.UpdateResponse(record=record)
|
149
144
|
|
150
|
-
|
151
|
-
Operations.operation_stream.add(update_response)
|
152
|
-
return None
|
153
|
-
else:
|
154
|
-
return update_response
|
145
|
+
Operations.operation_stream.add(update_response)
|
155
146
|
|
156
147
|
@staticmethod
|
157
148
|
def delete(table: str, keys: dict):
|
@@ -176,11 +167,7 @@ class Operations:
|
|
176
167
|
|
177
168
|
update_response = connector_sdk_pb2.UpdateResponse(record=record)
|
178
169
|
|
179
|
-
|
180
|
-
Operations.operation_stream.add(update_response)
|
181
|
-
return None
|
182
|
-
else:
|
183
|
-
return update_response
|
170
|
+
Operations.operation_stream.add(update_response)
|
184
171
|
|
185
172
|
@staticmethod
|
186
173
|
def checkpoint(state: dict):
|
@@ -205,12 +192,7 @@ class Operations:
|
|
205
192
|
"""
|
206
193
|
update_response = connector_sdk_pb2.UpdateResponse(checkpoint=connector_sdk_pb2.Checkpoint(state_json=json.dumps(state)))
|
207
194
|
|
208
|
-
|
209
|
-
Operations.operation_stream.add(update_response)
|
210
|
-
return None
|
211
|
-
else:
|
212
|
-
return update_response
|
213
|
-
|
195
|
+
Operations.operation_stream.add(update_response)
|
214
196
|
|
215
197
|
def _get_columns(table: str) -> dict:
|
216
198
|
"""Retrieves the columns for the specified table.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fivetran_connector_sdk
|
3
|
-
Version: 1.7.
|
3
|
+
Version: 1.7.5
|
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,9 +1,9 @@
|
|
1
|
-
fivetran_connector_sdk/__init__.py,sha256=
|
1
|
+
fivetran_connector_sdk/__init__.py,sha256=YFfBhbR_6c3tCivJ031zmq2zH4cKMblxVC4OrWAB-uI,22006
|
2
2
|
fivetran_connector_sdk/connector_helper.py,sha256=NDaaftRVsyEkdLFE8W59HFYpxfPsXZfIc1c0vTe03NI,43516
|
3
|
-
fivetran_connector_sdk/constants.py,sha256=
|
3
|
+
fivetran_connector_sdk/constants.py,sha256=hVUDRdWGODkOuBCt5iiFJQKiZMN_Cd_jz4iB4ZXqB3k,2293
|
4
4
|
fivetran_connector_sdk/helpers.py,sha256=k_iBaRacPN3YkOkZ8bLuflNYXkUrtuj6fYH_rV1M-RI,15224
|
5
5
|
fivetran_connector_sdk/logger.py,sha256=ud8v8-mKx65OAPaZvxBqt2-CU0vjgBeiYwuiqsYh_hA,3063
|
6
|
-
fivetran_connector_sdk/operations.py,sha256=
|
6
|
+
fivetran_connector_sdk/operations.py,sha256=wBk3YisTdcadj0A7pGkNGHT7OVSF0xKopM3RgxATvUY,12667
|
7
7
|
fivetran_connector_sdk/protos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
fivetran_connector_sdk/protos/common_pb2.py,sha256=zkzs6Rd-lvsev6Nsq37xc4HLJZ_uNXPkotCLY7Y7i5U,8770
|
9
9
|
fivetran_connector_sdk/protos/common_pb2.pyi,sha256=FdqlPKRqiXdUDT3e7adP5X42_Qzv_ItydUNJFKnJJIE,11478
|
@@ -11,8 +11,8 @@ fivetran_connector_sdk/protos/common_pb2_grpc.py,sha256=qni6h6BoA1nwJXr2bNtznfTk
|
|
11
11
|
fivetran_connector_sdk/protos/connector_sdk_pb2.py,sha256=qbce2wyScUg4cYRRjuYMgi5p0vb1zEA9Jf58polYhhs,7589
|
12
12
|
fivetran_connector_sdk/protos/connector_sdk_pb2.pyi,sha256=aE7DlQU3ZpuHK9aZrd1_cYs2_4Rl1lqSMw54BIXvYys,7721
|
13
13
|
fivetran_connector_sdk/protos/connector_sdk_pb2_grpc.py,sha256=bGlvc_vGwA9-FTqrj-BYlVcA-7jS8A9MSZ-XpZFytvY,8795
|
14
|
-
fivetran_connector_sdk-1.7.
|
15
|
-
fivetran_connector_sdk-1.7.
|
16
|
-
fivetran_connector_sdk-1.7.
|
17
|
-
fivetran_connector_sdk-1.7.
|
18
|
-
fivetran_connector_sdk-1.7.
|
14
|
+
fivetran_connector_sdk-1.7.5.dist-info/METADATA,sha256=WMGnfzFLrl0wdFT_J4wmGV2aTY6fR_mwohjJIVoMgNI,3188
|
15
|
+
fivetran_connector_sdk-1.7.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
16
|
+
fivetran_connector_sdk-1.7.5.dist-info/entry_points.txt,sha256=uQn0KPnFlQmXJfxlk0tifdNsSXWfVlnAFzNqjXZM_xM,57
|
17
|
+
fivetran_connector_sdk-1.7.5.dist-info/top_level.txt,sha256=-_xk2MFY4psIh7jw1lJePMzFb5-vask8_ZtX-UzYWUI,23
|
18
|
+
fivetran_connector_sdk-1.7.5.dist-info/RECORD,,
|
File without changes
|
{fivetran_connector_sdk-1.7.4.dist-info → fivetran_connector_sdk-1.7.5.dist-info}/entry_points.txt
RENAMED
File without changes
|
{fivetran_connector_sdk-1.7.4.dist-info → fivetran_connector_sdk-1.7.5.dist-info}/top_level.txt
RENAMED
File without changes
|