cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error in databricks-sql-connector

BorislavBlagoev
Valued Contributor III
from databricks import sql
 
hostname = '<name>.databricks.com'
http_path = '/sql/1.0/endpoints/<endpoint_id>'
access_token = '<personal_token>'
 
connection = sql.connect(server_hostname=hostname, http_path=http_path, access_token=access_token)
 
cursor = connection.cursor()
 
cursor.execute('test_query')
 
result = cursor.fetchall()
 
for row in result:
  print(row)
 
cursor.close()

I get the following error when I execute the code above in notebook.

I have permissions for the entrypoint that I use and access_token. I have removed them in the question!

Error during OpenSession; Request: TOpenSessionReq(client_protocol=5, username=None, password=None, configuration=None) Error: None Bounded-Retry-Delay: None Attempt: 1/30 Elapsed-Seconds: 1.3954582214355469/900.0
 
 
----> 7 connection = sql.connect(server_hostname=hostname, 
      8                          http_path=http_path,
      9                          access_token=access_token)
 
/databricks/python/lib/python3.8/site-packages/databricks/sql/__init__.py in connect(server_hostname, http_path, access_token, **kwargs)
     26     """
     27     from databricks.sql.client import Connection
---> 28     return Connection(server_hostname, http_path, access_token, **kwargs)
 
/databricks/python/lib/python3.8/site-packages/databricks/sql/client.py in __init__(self, server_hostname, http_path, access_token, **kwargs)
    261                 client_protocol=protocol_version
    262             )
--> 263             response = self._make_request(self._client.OpenSession, open_session_req)
    264             _check_status(response)
    265             assert response.sessionHandle is not None, "Expected a session from OpenSession"
 
/databricks/python/lib/python3.8/site-packages/databricks/sql/client.py in _make_request(self, method, request)
    372                     or elapsed + retry_delay > self._retry_stop_after_attempts_duration):
    373                 _logger.error("Error during " + log_base)
--> 374                 raise OperationalError("Error during Thrift request" +
    375                     (": " + error_message) if error_message else "",
    376                     error)
 
OperationalError: ('', EOFError())

16 REPLIES 16

Hi @Borislav Blagoev​ , were you able to check/adjust your IP access controls for your workspace, or ask your admin/support to do so?

Thanks a lot for the help the admins will help me to manage the IPs. Sorry for the slow response.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group