fivetran-connector-sdk 1.8.0__tar.gz → 2.0.0__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.
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/PKG-INFO +1 -1
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/__init__.py +2 -2
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/operations.py +28 -20
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk.egg-info/PKG-INFO +1 -1
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/README.md +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/pyproject.toml +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/setup.cfg +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/connector_helper.py +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/constants.py +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/helpers.py +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/logger.py +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/protos/__init__.py +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/protos/common_pb2.py +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/protos/common_pb2.pyi +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/protos/common_pb2_grpc.py +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.py +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/protos/connector_sdk_pb2.pyi +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/protos/connector_sdk_pb2_grpc.py +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk.egg-info/SOURCES.txt +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk.egg-info/dependency_links.txt +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk.egg-info/entry_points.txt +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk.egg-info/requires.txt +0 -0
- {fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/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:
|
3
|
+
Version: 2.0.0
|
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
|
{fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/__init__.py
RENAMED
@@ -41,8 +41,8 @@ from fivetran_connector_sdk.connector_helper import (
|
|
41
41
|
)
|
42
42
|
|
43
43
|
# Version format: <major_version>.<minor_version>.<patch_version>
|
44
|
-
# (where Major Version =
|
45
|
-
__version__ = "
|
44
|
+
# (where Major Version = 2, Minor Version is incremental MM from Aug 25 onwards, Patch Version is incremental within a month)
|
45
|
+
__version__ = "2.0.0"
|
46
46
|
TESTER_VERSION = TESTER_VER
|
47
47
|
MAX_MESSAGE_LENGTH = 32 * 1024 * 1024 # 32MB
|
48
48
|
|
@@ -178,11 +178,7 @@ class _OperationStream:
|
|
178
178
|
return connector_sdk_pb2.UpdateResponse(records=connector_sdk_pb2.Records(records=batch_to_flush))
|
179
179
|
|
180
180
|
|
181
|
-
_LOG_DATA_TYPE_INFERENCE = {
|
182
|
-
"boolean": True,
|
183
|
-
"binary": True,
|
184
|
-
"json": True
|
185
|
-
}
|
181
|
+
_LOG_DATA_TYPE_INFERENCE = {}
|
186
182
|
|
187
183
|
class Operations:
|
188
184
|
operation_stream = _OperationStream()
|
@@ -208,7 +204,7 @@ class Operations:
|
|
208
204
|
new_table = common_pb2.Table(name=table, columns=columns.values())
|
209
205
|
TABLES[table] = new_table
|
210
206
|
|
211
|
-
mapped_data = _map_data_to_columns(data, columns)
|
207
|
+
mapped_data = _map_data_to_columns(data, columns, table)
|
212
208
|
record = connector_sdk_pb2.Record(
|
213
209
|
schema_name=None,
|
214
210
|
table_name=table,
|
@@ -231,7 +227,7 @@ class Operations:
|
|
231
227
|
"""
|
232
228
|
table = get_renamed_table_name(table)
|
233
229
|
columns = _get_columns(table)
|
234
|
-
mapped_data = _map_data_to_columns(modified, columns)
|
230
|
+
mapped_data = _map_data_to_columns(modified, columns, table)
|
235
231
|
record = connector_sdk_pb2.Record(
|
236
232
|
schema_name=None,
|
237
233
|
table_name=table,
|
@@ -254,7 +250,7 @@ class Operations:
|
|
254
250
|
"""
|
255
251
|
table = get_renamed_table_name(table)
|
256
252
|
columns = _get_columns(table)
|
257
|
-
mapped_data = _map_data_to_columns(keys, columns)
|
253
|
+
mapped_data = _map_data_to_columns(keys, columns, table)
|
258
254
|
record = connector_sdk_pb2.Record(
|
259
255
|
schema_name=None,
|
260
256
|
table_name=table,
|
@@ -305,8 +301,24 @@ def _get_columns(table: str) -> dict:
|
|
305
301
|
|
306
302
|
return columns
|
307
303
|
|
304
|
+
def _get_table_pk(table: str) -> bool:
|
305
|
+
"""Retrieves the columns for the specified table.
|
306
|
+
|
307
|
+
Args:
|
308
|
+
table (str): The name of the table.
|
309
|
+
|
310
|
+
Returns:
|
311
|
+
dict: The columns for the table.
|
312
|
+
"""
|
313
|
+
columns = {}
|
314
|
+
if table in TABLES:
|
315
|
+
for column in TABLES[table].columns:
|
316
|
+
if column.primary_key:
|
317
|
+
return True
|
318
|
+
return False
|
319
|
+
|
308
320
|
|
309
|
-
def _map_data_to_columns(data: dict, columns: dict) -> dict:
|
321
|
+
def _map_data_to_columns(data: dict, columns: dict, table: str = "") -> dict:
|
310
322
|
"""Maps data to the specified columns.
|
311
323
|
|
312
324
|
Args:
|
@@ -324,35 +336,31 @@ def _map_data_to_columns(data: dict, columns: dict) -> dict:
|
|
324
336
|
elif (key in columns) and columns[key].type != common_pb2.DataType.UNSPECIFIED:
|
325
337
|
map_defined_data_type(columns[key].type, key, mapped_data, v)
|
326
338
|
else:
|
327
|
-
map_inferred_data_type(key, mapped_data, v)
|
339
|
+
map_inferred_data_type(key, mapped_data, v, table)
|
328
340
|
return mapped_data
|
329
341
|
|
330
|
-
def map_inferred_data_type(k, mapped_data, v):
|
342
|
+
def map_inferred_data_type(k, mapped_data, v, table=""):
|
331
343
|
# We can infer type from the value
|
332
344
|
if isinstance(v, int):
|
333
345
|
if abs(v) > JAVA_LONG_MAX_VALUE:
|
334
346
|
mapped_data[k] = common_pb2.ValueType(float=v)
|
335
347
|
else:
|
336
348
|
mapped_data[k] = common_pb2.ValueType(long=v)
|
337
|
-
if _LOG_DATA_TYPE_INFERENCE
|
338
|
-
print_library_log("Fivetran: Boolean Datatype has been inferred", Logging.Level.INFO, True)
|
339
|
-
|
349
|
+
if _LOG_DATA_TYPE_INFERENCE.get("boolean_" + table, True) and isinstance(v, bool):
|
350
|
+
print_library_log("Fivetran: Boolean Datatype has been inferred for " + table, Logging.Level.INFO, True)
|
351
|
+
if not _get_table_pk(table):
|
352
|
+
print_library_log("Fivetran: Boolean Datatype inference issue for " + table, Logging.Level.INFO, True)
|
353
|
+
_LOG_DATA_TYPE_INFERENCE["boolean_" + table] = False
|
340
354
|
elif isinstance(v, float):
|
341
355
|
mapped_data[k] = common_pb2.ValueType(float=v)
|
342
356
|
elif isinstance(v, bool):
|
343
357
|
mapped_data[k] = common_pb2.ValueType(bool=v)
|
344
358
|
elif isinstance(v, bytes):
|
345
|
-
if _LOG_DATA_TYPE_INFERENCE["binary"]:
|
346
|
-
print_library_log("Fivetran: Binary Datatype has been inferred", Logging.Level.INFO, True)
|
347
|
-
_LOG_DATA_TYPE_INFERENCE["binary"] = False
|
348
359
|
mapped_data[k] = common_pb2.ValueType(binary=v)
|
349
360
|
elif isinstance(v, list):
|
350
361
|
raise ValueError(
|
351
362
|
"Values for the columns cannot be of type 'list'. Please ensure that all values are of a supported type. Reference: https://fivetran.com/docs/connectors/connector-sdk/technical-reference#supporteddatatypes")
|
352
363
|
elif isinstance(v, dict):
|
353
|
-
if _LOG_DATA_TYPE_INFERENCE["json"]:
|
354
|
-
print_library_log("Fivetran: JSON Datatype has been inferred", Logging.Level.INFO, True)
|
355
|
-
_LOG_DATA_TYPE_INFERENCE["json"] = False
|
356
364
|
mapped_data[k] = common_pb2.ValueType(json=json.dumps(v))
|
357
365
|
elif isinstance(v, str):
|
358
366
|
mapped_data[k] = common_pb2.ValueType(string=v)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fivetran_connector_sdk
|
3
|
-
Version:
|
3
|
+
Version: 2.0.0
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/helpers.py
RENAMED
File without changes
|
{fivetran_connector_sdk-1.8.0 → fivetran_connector_sdk-2.0.0}/src/fivetran_connector_sdk/logger.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|