Skip to content
Merged
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release History

# 4.2.2 (2025-12-01)
- Change default use_hybrid_disposition to False (databricks/databricks-sql-python#714 by @samikshya-db)
- Circuit breaker changes using pybreaker (databricks/databricks-sql-python#705 by @nikhilsuri-db)
- perf: Optimize telemetry latency logging to reduce overhead (databricks/databricks-sql-python#715 by @samikshya-db)
- basic e2e test for force telemetry verification (databricks/databricks-sql-python#708 by @nikhilsuri-db)
- Telemetry is ON by default to track connection stats. (Note : This strictly excludes PII, query text, and results) (databricks/databricks-sql-python#717 by @samikshya-db)

# 4.2.1 (2025-11-20)
- Ignore transactions by default (databricks/databricks-sql-python#711 by @jayantsing-db)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ You are welcome to file an issue here for general use cases. You can also contac

## Requirements

Python 3.8 or above is required.
Python 3.9 or above is required.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "databricks-sql-connector"
version = "4.2.1"
version = "4.2.2"
description = "Databricks SQL Connector for Python"
authors = ["Databricks <[email protected]>"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/databricks/sql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __repr__(self):
DATE = DBAPITypeObject("date")
ROWID = DBAPITypeObject()

__version__ = "4.2.1"
__version__ = "4.2.2"
USER_AGENT_NAME = "PyDatabricksSqlConnector"

# These two functions are pyhive legacy
Expand Down
2 changes: 1 addition & 1 deletion src/databricks/sql/auth/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
pool_connections: Optional[int] = None,
pool_maxsize: Optional[int] = None,
user_agent: Optional[str] = None,
telemetry_circuit_breaker_enabled: Optional[bool] = None,
telemetry_circuit_breaker_enabled: Optional[bool] = True,
):
self.hostname = hostname
self.access_token = access_token
Expand Down
2 changes: 1 addition & 1 deletion src/databricks/sql/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def read(self) -> Optional[OAuthToken]:
self.ignore_transactions = ignore_transactions

self.force_enable_telemetry = kwargs.get("force_enable_telemetry", False)
self.enable_telemetry = kwargs.get("enable_telemetry", False)
self.enable_telemetry = kwargs.get("enable_telemetry", True)
self.telemetry_enabled = TelemetryHelper.is_telemetry_enabled(self)

TelemetryClientFactory.initialize_telemetry_client(
Expand Down
14 changes: 12 additions & 2 deletions tests/e2e/test_telemetry_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ def telemetry_setup_teardown(self):
TelemetryClientFactory._stop_flush_thread()
TelemetryClientFactory._initialized = False

# Clear feature flags cache to prevent state leakage between tests
from databricks.sql.common.feature_flag import FeatureFlagsContextFactory
with FeatureFlagsContextFactory._lock:
FeatureFlagsContextFactory._context_map.clear()
if FeatureFlagsContextFactory._executor:
FeatureFlagsContextFactory._executor.shutdown(wait=False)
FeatureFlagsContextFactory._executor = None

@pytest.fixture
def telemetry_interceptors(self):
"""Setup reusable telemetry interceptors as a fixture"""
Expand Down Expand Up @@ -142,7 +150,7 @@ def verify_events(self, captured_events, captured_futures, expected_count):
else:
assert len(captured_events) == expected_count, \
f"Expected {expected_count} events, got {len(captured_events)}"

time.sleep(2)
done, _ = wait(captured_futures, timeout=10)
assert len(done) == expected_count, \
Expand All @@ -163,7 +171,7 @@ def verify_events(self, captured_events, captured_futures, expected_count):
(True, False, 2, "enable_on_force_off"),
(False, True, 2, "enable_off_force_on"),
(False, False, 0, "both_off"),
(None, None, 0, "default_behavior"),
(None, None, 2, "default_behavior"),
])
def test_telemetry_flags(self, telemetry_interceptors, enable_telemetry,
force_enable, expected_count, test_id):
Expand All @@ -185,6 +193,8 @@ def test_telemetry_flags(self, telemetry_interceptors, enable_telemetry,
cursor.execute("SELECT 1")
cursor.fetchone()

# Give time for async telemetry submission after connection closes
time.sleep(0.5)
self.verify_events(captured_events, captured_futures, expected_count)

# Assert statement execution on latency event (if events exist)
Expand Down
Loading