fivetran-connector-sdk 0.7.19.1__py3-none-any.whl → 0.7.23.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.
@@ -13,6 +13,7 @@ import traceback
13
13
 
14
14
  from concurrent import futures
15
15
  from datetime import datetime
16
+ from enum import Enum
16
17
  from google.protobuf import timestamp_pb2
17
18
  from zipfile import ZipFile, ZIP_DEFLATED
18
19
 
@@ -38,24 +39,40 @@ TABLES = {}
38
39
 
39
40
 
40
41
  class Logging:
42
+ class Level(Enum):
43
+ FINE = 1
44
+ INFO = 2
45
+ WARNING = 3
46
+ SEVERE = 4
47
+
48
+ LOG_LEVEL = None
49
+
41
50
  @staticmethod
42
- def __log(level: str, message: str):
51
+ def __log(level: Level, message: str):
43
52
  if DEBUGGING:
44
53
  print(message)
45
54
  else:
46
55
  print(f'{{"level":"{level}", "message": "{message}", "message-origin": "connector_sdk"}}')
47
56
 
57
+ @staticmethod
58
+ def fine(message: str):
59
+ if DEBUGGING and Logging.LOG_LEVEL == Logging.Level.FINE:
60
+ Logging.__log(Logging.Level.FINE, message)
61
+
48
62
  @staticmethod
49
63
  def info(message: str):
50
- Logging.__log("INFO", message)
64
+ if Logging.LOG_LEVEL == Logging.Level.INFO:
65
+ Logging.__log(Logging.Level.INFO, message)
51
66
 
52
67
  @staticmethod
53
68
  def warning(message: str):
54
- Logging.__log("WARNING", message)
69
+ if Logging.LOG_LEVEL == Logging.Level.WARNING:
70
+ Logging.__log(Logging.Level.WARNING, message)
55
71
 
56
72
  @staticmethod
57
73
  def severe(message: str):
58
- Logging.__log("SEVERE", message)
74
+ if Logging.LOG_LEVEL == Logging.Level.SEVERE:
75
+ Logging.__log(Logging.Level.SEVERE, message)
59
76
 
60
77
 
61
78
  class Operations:
@@ -465,9 +482,14 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
465
482
  os._exit(1)
466
483
 
467
484
  # Call this method to run the connector in production
468
- def run(self, port: int = 50051, configuration: dict = None, state: dict = None) -> grpc.Server:
485
+ def run(self,
486
+ port: int = 50051,
487
+ configuration: dict = None,
488
+ state: dict = None,
489
+ log_level: Logging.Level = Logging.Level.INFO) -> grpc.Server:
469
490
  self.configuration = _check_dict(configuration, True)
470
491
  self.state = _check_dict(state)
492
+ Logging.LOG_LEVEL = log_level
471
493
 
472
494
  server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
473
495
  connector_sdk_pb2_grpc.add_ConnectorServicer_to_server(self, server)
@@ -479,10 +501,16 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
479
501
  server.wait_for_termination()
480
502
 
481
503
  # This method starts both the server and the local testing environment
482
- def debug(self, project_path: str = None, port: int = 50051, configuration: dict = None, state: dict = None) -> bool:
504
+ def debug(self,
505
+ project_path: str = None,
506
+ port: int = 50051,
507
+ configuration: dict = None,
508
+ state: dict = None,
509
+ log_level: Logging.Level = Logging.Level.FINE) -> bool:
483
510
  global DEBUGGING
484
511
  DEBUGGING = True
485
512
 
513
+ Logging.LOG_LEVEL = log_level
486
514
  os_name = self.__get_os_name()
487
515
  tester_root_dir = os.path.join(os.path.expanduser("~"), ROOT_LOCATION)
488
516
  java_exe = self.__java_exe(tester_root_dir, os_name)
@@ -535,7 +563,7 @@ class Connector(connector_sdk_pb2_grpc.ConnectorServicer):
535
563
 
536
564
  project_path = os.getcwd() if project_path is None else project_path
537
565
  print(f"Debugging connector at: {project_path}")
538
- server = self.run(port, configuration, state)
566
+ server = self.run(port, configuration, state, log_level=log_level)
539
567
 
540
568
  # Uncomment this to run the tester manually
541
569
  #server.wait_for_termination()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fivetran_connector_sdk
3
- Version: 0.7.19.1
3
+ Version: 0.7.23.1
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,4 +1,4 @@
1
- fivetran_connector_sdk/__init__.py,sha256=jtWQ3rdld5NNGgg9xtAUS52NKx8IFlgNsjq9JImma1o,32535
1
+ fivetran_connector_sdk/__init__.py,sha256=M__-L8nT-NIHEFVRXLpz3LBQVZgImyN_luVhX2zJQfs,33364
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,9 +6,9 @@ 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.7.19.1.dist-info/LICENSE,sha256=Kutp3D0T7HmHuBifKmbw39OZLAL1ckaLRb8u9lyJxE8,1065
10
- fivetran_connector_sdk-0.7.19.1.dist-info/METADATA,sha256=8PeBzQREQJGiIl4mjVHkEdFx1-5KviF4-RPixfEb6mw,651
11
- fivetran_connector_sdk-0.7.19.1.dist-info/WHEEL,sha256=-oYQCr74JF3a37z2nRlQays_SX2MqOANoqVjBBAP2yE,91
12
- fivetran_connector_sdk-0.7.19.1.dist-info/entry_points.txt,sha256=uQn0KPnFlQmXJfxlk0tifdNsSXWfVlnAFzNqjXZM_xM,57
13
- fivetran_connector_sdk-0.7.19.1.dist-info/top_level.txt,sha256=-_xk2MFY4psIh7jw1lJePMzFb5-vask8_ZtX-UzYWUI,23
14
- fivetran_connector_sdk-0.7.19.1.dist-info/RECORD,,
9
+ fivetran_connector_sdk-0.7.23.1.dist-info/LICENSE,sha256=Kutp3D0T7HmHuBifKmbw39OZLAL1ckaLRb8u9lyJxE8,1065
10
+ fivetran_connector_sdk-0.7.23.1.dist-info/METADATA,sha256=7SdSujAanafdTc4v-lCwGY7-BMkVibhq8snqcs7mOIc,651
11
+ fivetran_connector_sdk-0.7.23.1.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
12
+ fivetran_connector_sdk-0.7.23.1.dist-info/entry_points.txt,sha256=uQn0KPnFlQmXJfxlk0tifdNsSXWfVlnAFzNqjXZM_xM,57
13
+ fivetran_connector_sdk-0.7.23.1.dist-info/top_level.txt,sha256=-_xk2MFY4psIh7jw1lJePMzFb5-vask8_ZtX-UzYWUI,23
14
+ fivetran_connector_sdk-0.7.23.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (71.0.3)
2
+ Generator: setuptools (71.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5