forked from databricks/databricks-sql-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriverConnectionParameters.py
More file actions
41 lines (36 loc) · 1.25 KB
/
DriverConnectionParameters.py
File metadata and controls
41 lines (36 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import json
from dataclasses import dataclass, asdict
from databricks.sql.telemetry.HostDetails import HostDetails
from databricks.sql.telemetry.enums.AuthMech import AuthMech
from databricks.sql.telemetry.enums.AuthFlow import AuthFlow
from databricks.sql.telemetry.enums.DatabricksClientType import DatabricksClientType
@dataclass
class DriverConnectionParameters:
http_path: str
driver_mode: DatabricksClientType
host_details: HostDetails
auth_mech: AuthMech
auth_flow: AuthFlow
auth_scope: str
discovery_url: str
allowed_volume_ingestion_paths: str
azure_tenant_id: str
socket_timeout: int
def to_json(self):
return json.dumps(asdict(self))
# Part of TelemetryEvent
# DriverConnectionParameters connectionParams = new DriverConnectionParameters(
# httpPath = " /sql/1.0/endpoints/1234567890abcdef",
# driverMode = "THRIFT",
# hostDetails = new HostDetails(
# hostUrl = "https://my-workspace.cloud.databricks.com",
# port = 443
# ),
# authMech = "OAUTH",
# authFlow = "AZURE_MANAGED_IDENTITIES",
# authScope = "sql",
# discoveryUrl = "https://example-url",
# allowedVolumeIngestionPaths = "[]",
# azureTenantId = "1234567890abcdef",
# socketTimeout = 10000
# )