fivetran-connector-sdk 1.7.3__tar.gz → 1.7.5__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 (23) hide show
  1. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/PKG-INFO +1 -1
  2. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/__init__.py +25 -34
  3. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/constants.py +0 -1
  4. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/operations.py +8 -26
  5. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk.egg-info/PKG-INFO +1 -1
  6. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/README.md +0 -0
  7. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/pyproject.toml +0 -0
  8. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/setup.cfg +0 -0
  9. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/connector_helper.py +0 -0
  10. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/helpers.py +0 -0
  11. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/logger.py +0 -0
  12. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/protos/__init__.py +0 -0
  13. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/protos/common_pb2.py +0 -0
  14. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/protos/common_pb2.pyi +0 -0
  15. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/protos/common_pb2_grpc.py +0 -0
  16. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.py +0 -0
  17. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.pyi +0 -0
  18. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk/protos/connector_sdk_pb2_grpc.py +0 -0
  19. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk.egg-info/SOURCES.txt +0 -0
  20. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk.egg-info/dependency_links.txt +0 -0
  21. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk.egg-info/entry_points.txt +0 -0
  22. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk.egg-info/requires.txt +0 -0
  23. {fivetran_connector_sdk-1.7.3 → fivetran_connector_sdk-1.7.5}/src/fivetran_connector_sdk.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fivetran_connector_sdk
3
- Version: 1.7.3
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
@@ -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.3"
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
- if os.environ.get(CONNECTOR_SDK_NO_YIELD_LABEL, "false").lower() == "true":
380
- def run_update():
381
- try:
382
- result = self.update_method(configuration=configuration, state=state)
383
- # If the customer's update method returns a generator (i.e., uses yield),
384
- # exhaust the generator responses, they are None. From this point on, all operations
385
- # push update_response to a queue, and we yield from the queue instead.
386
- # We return None here intentionally.
387
- if isinstance(result, GeneratorType):
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
- except Exception as exc:
394
- exception_queue.put(exc)
395
- finally:
396
- Operations.operation_stream.mark_done()
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
- thread = threading.Thread(target=run_update)
399
- thread.start()
396
+ thread = threading.Thread(target=run_update)
397
+ thread.start()
400
398
 
401
- yield from Operations.operation_stream
399
+ yield from Operations.operation_stream
402
400
 
403
- thread.join()
401
+ thread.join()
404
402
 
405
- # Check if any exception was raised during the update
406
- if not exception_queue.empty():
407
- raise exception_queue.get()
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, CONNECTOR_SDK_NO_YIELD_LABEL,
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
- if Operations.use_no_yield_approach:
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
- if Operations.use_no_yield_approach:
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
- if Operations.use_no_yield_approach:
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
- if Operations.use_no_yield_approach:
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.
@@ -257,12 +239,12 @@ def map_inferred_data_type(k, mapped_data, v):
257
239
  mapped_data[k] = common_pb2.ValueType(float=v)
258
240
  else:
259
241
  mapped_data[k] = common_pb2.ValueType(long=v)
242
+ if _LOG_DATA_TYPE_INFERENCE["boolean"] and isinstance(v, bool):
243
+ print_library_log("Fivetran: Boolean Datatype has been inferred", Logging.Level.INFO, True)
244
+ _LOG_DATA_TYPE_INFERENCE["boolean"] = False
260
245
  elif isinstance(v, float):
261
246
  mapped_data[k] = common_pb2.ValueType(float=v)
262
247
  elif isinstance(v, bool):
263
- if _LOG_DATA_TYPE_INFERENCE["boolean"]:
264
- print_library_log("Fivetran: Boolean Datatype has been inferred", Logging.Level.INFO, True)
265
- _LOG_DATA_TYPE_INFERENCE["boolean"] = False
266
248
  mapped_data[k] = common_pb2.ValueType(bool=v)
267
249
  elif isinstance(v, bytes):
268
250
  if _LOG_DATA_TYPE_INFERENCE["binary"]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fivetran_connector_sdk
3
- Version: 1.7.3
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