cloe-logging 0.3.9__py3-none-any.whl → 0.3.10__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.
@@ -7,9 +7,11 @@ from datetime import UTC, datetime
7
7
 
8
8
  try:
9
9
  import requests
10
+
11
+ _REQUESTS_AVAILABLE = True
10
12
  except ImportError:
11
13
  requests = None # type: ignore
12
- print("Optional dependency 'log_analytics' is not installed. Some functionalities may not be available.")
14
+ _REQUESTS_AVAILABLE = False
13
15
 
14
16
  from cloe_logging.utility.serializer import create_logserializer
15
17
 
@@ -60,6 +62,10 @@ class LogAnalyticsHandler(logging.Handler):
60
62
  raise ValueError(
61
63
  "The workspace_id, shared_key, and log_type must be provided or set as environment variables."
62
64
  )
65
+ if not _REQUESTS_AVAILABLE:
66
+ raise ImportError(
67
+ "Requests library is not installed. Install it with: pip install cloe-logging[log-analytics]"
68
+ )
63
69
  logging.Handler.__init__(self)
64
70
  self.session = requests.Session()
65
71
  formatter = logging.Formatter("timestamp:%(asctime)s | level: %(levelname)-8s | %(message)s")
@@ -6,10 +6,12 @@ try:
6
6
  ConnectionParameters,
7
7
  )
8
8
  from cloe_util_snowflake_connector.snowflake_interface import SnowflakeInterface # type: ignore[import-not-found]
9
+
10
+ _SNOWFLAKE_AVAILABLE = True
9
11
  except ImportError:
10
12
  ConnectionParameters = None # type: ignore
11
13
  SnowflakeInterface = None # type: ignore
12
- print("Optional dependency 'snowflake' is not installed. Some functionalities may not be available.")
14
+ _SNOWFLAKE_AVAILABLE = False
13
15
  from cloe_logging.utility.serializer import create_logserializer
14
16
 
15
17
 
@@ -80,6 +82,10 @@ class SnowflakeHandler(logging.Handler):
80
82
  return hash((self.target_db, self.target_schema, self.target_table))
81
83
 
82
84
  def _get_snowflake_connection(self) -> SnowflakeInterface:
85
+ if not _SNOWFLAKE_AVAILABLE:
86
+ raise ImportError(
87
+ "Snowflake dependencies are not installed. Install them with: pip install cloe-logging[snowflake]"
88
+ )
83
89
  conn_params = ConnectionParameters.init_from_env_variables()
84
90
  return SnowflakeInterface(conn_params)
85
91
 
@@ -5,10 +5,12 @@ from typing import cast
5
5
  try:
6
6
  from databricks.sdk import WorkspaceClient # type: ignore[import-not-found]
7
7
  from databricks.sdk.service.sql import ExecuteStatementRequestOnWaitTimeout # type: ignore[import-not-found]
8
+
9
+ _DATABRICKS_AVAILABLE = True
8
10
  except ImportError:
9
11
  WorkspaceClient = None # type: ignore
10
12
  ExecuteStatementRequestOnWaitTimeout = None # type: ignore
11
- print("Optional dependency 'databricks' is not installed. Some functionalities may not be available.")
13
+ _DATABRICKS_AVAILABLE = False
12
14
 
13
15
  from ..formatters import DictFormatter
14
16
 
@@ -64,6 +66,8 @@ class UnityCatalogHandler(logging.Handler):
64
66
  " schema, and table to create a DatabricksHandler."
65
67
  )
66
68
  self.table_identifier = f"{self.catalog}.{self.schema}.{self.table}"
69
+ if not _DATABRICKS_AVAILABLE:
70
+ raise ImportError("Databricks SDK is not installed. Install it with: pip install cloe-logging[databricks]")
67
71
  self.workspace_client = workspace_client or WorkspaceClient(host=self.workspace_url)
68
72
  super().__init__(**kwargs)
69
73
  self.setFormatter(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloe-logging
3
- Version: 0.3.9
3
+ Version: 0.3.10
4
4
  Summary: A Standardized Solution for logging to various targets.
5
5
  Author-email: David Achilles <david.achilles@accenture.com>, Ole Steinbrueck <ole.steinbrueck@accenture.com>
6
6
  License: Proprietary
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Topic :: Database
15
- Requires-Python: <3.13,>=3.11
15
+ Requires-Python: <3.14,>=3.11
16
16
  Requires-Dist: pydantic<3.0.0,>=2.7.0
17
17
  Requires-Dist: typing-extensions<5.0.0,>=4.12.2
18
18
  Provides-Extra: databricks
@@ -7,11 +7,11 @@ cloe_logging/formatters/__init__.py,sha256=1hhmT6qeIGuom63oHrg_2SHQZpLWG2GclMSTm
7
7
  cloe_logging/formatters/devops_formatter.py,sha256=EeTgN932jGisW1Q_z9RXdd0yvXuOgbN-CuFaSQ3usss,3315
8
8
  cloe_logging/formatters/dict_formatter.py,sha256=QGUcCx3KrCAXFGkYD3SY4s13k0OIgSBn6fhijgJ4m0Y,1553
9
9
  cloe_logging/handlers/__init__.py,sha256=5RTIz8UooLgVc9h5GnXvI2yF-FkOKiJBfHbSKHKitRE,236
10
- cloe_logging/handlers/log_analytics_handler.py,sha256=x5gX98srlvBsEFmIWTISzO0v1Fx-O6CfsBDvyigA4YI,9048
11
- cloe_logging/handlers/snowflake_handler.py,sha256=TWctiCR10UacVrkDCIF6Z1GvuhfhC7iIpNefzdTgd0Q,5049
12
- cloe_logging/handlers/unity_catalog_handler.py,sha256=DabwGA-2_F1BGGUZnEA9YMSIPmeaUkhkKjo3Fm-rXps,6928
10
+ cloe_logging/handlers/log_analytics_handler.py,sha256=gPTKS0l3EaB7pZWUSr42cOQT99m8Vj0KeQlaNA6UDfI,9199
11
+ cloe_logging/handlers/snowflake_handler.py,sha256=gdFdTlXhi7FHbJJRIhmuFwll6WflgVZ-SxendEfQUxI,5206
12
+ cloe_logging/handlers/unity_catalog_handler.py,sha256=5_-AwlcjCz2Mddk4J0L7Y2iDaTmdISTZsxmnQgnBhcI,7047
13
13
  cloe_logging/utility/__init__.py,sha256=wp758l5P1M20bNUbbGojSkBUscFUgRd_TLLdnHgQ_l8,70
14
14
  cloe_logging/utility/serializer.py,sha256=a_XNHC3DTPongLXcEBp7UCvVdmdjT-qAQ9ZHubCV0oI,2656
15
- cloe_logging-0.3.9.dist-info/METADATA,sha256=QsOVBzsajELGWn-VhU9_uLYuVAEfAuYA7q5fcv7-GpQ,2487
16
- cloe_logging-0.3.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
- cloe_logging-0.3.9.dist-info/RECORD,,
15
+ cloe_logging-0.3.10.dist-info/METADATA,sha256=SONYSRL1RM-_3fPSdyNKs2YBvinc-DV4Ddr5YNj1a-E,2488
16
+ cloe_logging-0.3.10.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
+ cloe_logging-0.3.10.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any