Skip to content

Commit d72fb27

Browse files
committed
fixed doc string
Signed-off-by: Sai Shree Pradhan <[email protected]>
1 parent 95e43e4 commit d72fb27

File tree

2 files changed

+69
-44
lines changed

2 files changed

+69
-44
lines changed

src/databricks/sql/telemetry/telemetry_event.py

Lines changed: 61 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,29 @@
1212

1313
@dataclass
1414
class HostDetails:
15-
host_url: str
16-
port: int
15+
"""
16+
Part of DriverConnectionParameters
1717
18-
""" Part of DriverConnectionParameters
18+
Example:
1919
HostDetails hostDetails = new HostDetails(
2020
hostUrl = "https://my-workspace.cloud.databricks.com",
2121
port = 443
2222
)
2323
"""
2424

25+
host_url: str
26+
port: int
27+
2528
def to_json(self):
2629
return json.dumps(asdict(self))
2730

2831

2932
@dataclass
3033
class DriverConnectionParameters:
31-
http_path: str
32-
mode: DatabricksClientType
33-
host_info: HostDetails
34-
auth_mech: AuthMech
35-
auth_flow: AuthFlow
36-
auth_scope: str
37-
discovery_url: str
38-
allowed_volume_ingestion_paths: str
39-
azure_tenant_id: str
40-
socket_timeout: int
34+
"""
35+
Part of TelemetryEvent
4136
42-
""" Part of TelemetryEvent
37+
Example:
4338
DriverConnectionParameters connectionParams = new DriverConnectionParameters(
4439
httpPath = " /sql/1.0/endpoints/1234567890abcdef",
4540
driverMode = "THRIFT",
@@ -54,27 +49,30 @@ class DriverConnectionParameters:
5449
allowedVolumeIngestionPaths = "[]",
5550
azureTenantId = "1234567890abcdef",
5651
socketTimeout = 10000
57-
)"""
52+
)
53+
"""
54+
55+
http_path: str
56+
mode: DatabricksClientType
57+
host_info: HostDetails
58+
auth_mech: AuthMech
59+
auth_flow: AuthFlow
60+
auth_scope: str
61+
discovery_url: str
62+
allowed_volume_ingestion_paths: str
63+
azure_tenant_id: str
64+
socket_timeout: int
5865

5966
def to_json(self):
6067
return json.dumps(asdict(self))
6168

6269

6370
@dataclass
6471
class DriverSystemConfiguration:
65-
driver_version: str
66-
os_name: str
67-
os_version: str
68-
os_arch: str
69-
runtime_name: str
70-
runtime_version: str
71-
runtime_vendor: str
72-
client_app_name: str
73-
locale_name: str
74-
driver_name: str
75-
char_set_encoding: str
72+
"""
73+
Part of TelemetryEvent
7674
77-
"""Part of TelemetryEvent
75+
Example:
7876
DriverSystemConfiguration systemConfig = new DriverSystemConfiguration(
7977
driver_version = "2.9.3",
8078
os_name = "Darwin",
@@ -90,32 +88,47 @@ class DriverSystemConfiguration:
9088
)
9189
"""
9290

91+
driver_version: str
92+
os_name: str
93+
os_version: str
94+
os_arch: str
95+
runtime_name: str
96+
runtime_version: str
97+
runtime_vendor: str
98+
client_app_name: str
99+
locale_name: str
100+
driver_name: str
101+
char_set_encoding: str
102+
93103
def to_json(self):
94104
return json.dumps(asdict(self))
95105

96106

97107
@dataclass
98108
class DriverVolumeOperation:
99-
volume_operation_type: DriverVolumeOperationType
100-
volume_path: str
109+
"""
110+
Part of TelemetryEvent
101111
102-
""" Part of TelemetryEvent
112+
Example:
103113
DriverVolumeOperation volumeOperation = new DriverVolumeOperation(
104114
volumeOperationType = "LIST",
105115
volumePath = "/path/to/volume"
106116
)
107117
"""
108118

119+
volume_operation_type: DriverVolumeOperationType
120+
volume_path: str
121+
109122
def to_json(self):
110123
return json.dumps(asdict(self))
111124

112125

113126
@dataclass
114127
class DriverErrorInfo:
115-
error_name: str
116-
stack_trace: str
128+
"""
129+
Required for ErrorLogs
117130
118-
"""Required for ErrorLogs
131+
Example:
119132
DriverErrorInfo errorInfo = new DriverErrorInfo(
120133
errorName="CONNECTION_ERROR",
121134
stackTrace="Connection failure while using the Databricks SQL Python connector. Failed to connect to server: https://my-workspace.cloud.databricks.com\n" +
@@ -124,27 +137,35 @@ class DriverErrorInfo:
124137
"at databricks.sql.thrift_backend.ThriftBackend.attempt_request(ThriftBackend.py:366)\n" +
125138
"at databricks.sql.thrift_backend.ThriftBackend.open_session(ThriftBackend.py:575)\n" +
126139
"at databricks.sql.client.Connection.__init__(client.py:69)\n" +
127-
"at databricks.sql.client.connect(connection.py:123)")
140+
"at databricks.sql.client.connect(connection.py:123)"
141+
)
128142
"""
129143

144+
error_name: str
145+
stack_trace: str
146+
130147
def to_json(self):
131148
return json.dumps(asdict(self))
132149

133150

134151
@dataclass
135152
class SqlExecutionEvent:
136-
statement_type: StatementType
137-
is_compressed: bool
138-
execution_result: ExecutionResultFormat
139-
retry_count: int
153+
"""
154+
Part of TelemetryEvent
140155
141-
"""Part of TelemetryEvent
156+
Example:
142157
SqlExecutionEvent sqlExecutionEvent = new SqlExecutionEvent(
143158
statementType = "QUERY",
144159
isCompressed = true,
145160
executionResult = "INLINE_ARROW",
146161
retryCount = 0
147-
)"""
162+
)
163+
"""
164+
165+
statement_type: StatementType
166+
is_compressed: bool
167+
execution_result: ExecutionResultFormat
168+
retry_count: int
148169

149170
def to_json(self):
150171
return json.dumps(asdict(self))

src/databricks/sql/telemetry/telemetry_frontend_log.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@
55

66
@dataclass
77
class TelemetryClientContext:
8-
timestamp_millis: int
9-
user_agent: str
8+
"""
9+
Used in FrontendLogContext
1010
11-
"""used in FrontendLogContext
11+
Example:
1212
TelemetryClientContext clientContext = new TelemetryClientContext(
1313
timestampMillis = 1716489600000,
1414
userAgent = "databricks-sql-python-test"
15-
)"""
15+
)
16+
"""
17+
18+
timestamp_millis: int
19+
user_agent: str
1620

1721
def to_json(self):
1822
return json.dumps(asdict(self))

0 commit comments

Comments
 (0)