1
- #!/usr/bin/env python
2
-
3
1
import os
4
2
import sys
5
3
import logging
6
4
from databricks .sql .client import Connection
7
5
8
- # Configure logging
9
6
logging .basicConfig (level = logging .DEBUG )
10
7
logger = logging .getLogger (__name__ )
11
8
@@ -21,7 +18,6 @@ def test_sea_session():
21
18
- DATABRICKS_HTTP_PATH: HTTP path for the SQL endpoint
22
19
- DATABRICKS_TOKEN: Personal access token for authentication
23
20
"""
24
- # Get connection parameters from environment variables
25
21
server_hostname = os .environ .get ("DATABRICKS_SERVER_HOSTNAME" )
26
22
http_path = os .environ .get ("DATABRICKS_HTTP_PATH" )
27
23
access_token = os .environ .get ("DATABRICKS_TOKEN" )
@@ -32,25 +28,25 @@ def test_sea_session():
32
28
logger .error ("Please set DATABRICKS_SERVER_HOSTNAME, DATABRICKS_HTTP_PATH, and DATABRICKS_TOKEN." )
33
29
sys .exit (1 )
34
30
35
- # Print connection info (partially masked)
36
31
logger .info (f"Connecting to { server_hostname } " )
37
32
logger .info (f"HTTP Path: { http_path } " )
38
33
if catalog :
39
34
logger .info (f"Using catalog: { catalog } " )
40
35
41
36
try :
42
- # Create connection with SEA backend
43
37
logger .info ("Creating connection with SEA backend..." )
44
38
connection = Connection (
45
39
server_hostname = server_hostname ,
46
40
http_path = http_path ,
47
41
access_token = access_token ,
48
42
catalog = catalog ,
49
- use_sea = True , # Enable SEA backend
50
- user_agent_entry = "SEA-Test-Client" # Add custom user agent
43
+ schema = "default" ,
44
+ use_sea = True ,
45
+ user_agent_entry = "SEA-Test-Client" # add custom user agent
51
46
)
52
47
53
48
logger .info (f"Successfully opened SEA session with ID: { connection .get_session_id_hex ()} " )
49
+ logger .info (f"backend type: { type (connection .session .backend )} " )
54
50
55
51
# Close the connection
56
52
logger .info ("Closing the SEA session..." )
0 commit comments