Skip to content

Commit a4c92b0

Browse files
make imports as specific as possible
1 parent 1ea5c64 commit a4c92b0

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

sentry_sdk/integrations/clickhouse_driver.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ def __getitem__(self, _):
3030

3131

3232
try:
33-
import clickhouse_driver # type: ignore[import-not-found]
34-
from clickhouse_driver.client import Client
33+
from clickhouse_driver import VERSION
34+
from clickhouse_driver.client import Client # type: ignore[import-not-found]
35+
from clickhouse_driver.connection import Connection # type: ignore[import-not-found]
3536

3637
except ImportError:
3738
raise DidNotEnable("clickhouse-driver not installed.")
@@ -43,12 +44,10 @@ class ClickhouseDriverIntegration(Integration):
4344

4445
@staticmethod
4546
def setup_once() -> None:
46-
_check_minimum_version(ClickhouseDriverIntegration, clickhouse_driver.VERSION)
47+
_check_minimum_version(ClickhouseDriverIntegration, VERSION)
4748

4849
# Every query is done using the Connection's `send_query` function
49-
clickhouse_driver.connection.Connection.send_query = _wrap_start(
50-
clickhouse_driver.connection.Connection.send_query
51-
)
50+
Connection.send_query = _wrap_start(Connection.send_query)
5251

5352
# If the query contains parameters then the send_data function is used to send those parameters to clickhouse
5453
_wrap_send_data()
@@ -164,9 +163,7 @@ def wrapped_generator() -> "Iterator[Any]":
164163
Client.send_data = _inner_send_data
165164

166165

167-
def _set_db_data(
168-
span: "Span", connection: "clickhouse_driver.connection.Connection"
169-
) -> None:
166+
def _set_db_data(span: "Span", connection: "Connection") -> None:
170167
span.set_data(SPANDATA.DB_SYSTEM, "clickhouse")
171168
span.set_data(SPANDATA.SERVER_ADDRESS, connection.host)
172169
span.set_data(SPANDATA.SERVER_PORT, connection.port)

0 commit comments

Comments
 (0)