cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

dbsqlcli.main ERROR - getaddrinfo failed

Herkimer
New Contributor II

I had to rebuild my laptop and am trying to re-install Databricks and Databricks-sql-cli so I can use the CLI to pull info from the databricks repository.

When I try to run the command: dbsqlcli -e "select distinct tableName from databases_info.all_db_tbl_clm"

I get the error: Error during request to server: [Errno 11001] getaddrinfo failed

-----

I am able to get a valid response from the DOS command: databricks workspace ls

I have updated the credentials section of the dbsqlclirc file to populate host_name, http_path and access_token.

http_path and access_token match the ones in the .databrickscfg file.

I went into the databricks compute clusters and copied the name into host_name.

Here is the app.log extract, slightly redacted:

2023-03-21 11:41:08,099 (11320/MainThread) dbsqlcli.main ERROR - error: RequestError('Error during request to server: [Errno 11001] getaddrinfo failed', gaierror(11001, 'getaddrinfo failed'))

Traceback (most recent call last):

 File "%userinfo%\AppData\Roaming\Python\Python311\site-packages\dbsqlcli\main.py", line 94, in __init__

  self.connect(hostname, http_path, access_token, database)

 File "%userinfo%\AppData\Roaming\Python\Python311\site-packages\dbsqlcli\main.py", line 228, in connect

  self.sqlexecute = SQLExecute(hostname, http_path, access_token, database)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 File "%userinfo%\AppData\Roaming\Python\Python311\site-packages\dbsqlcli\sqlexecute.py", line 27, in __init__

  self.connect(database=self.database)

 File "%userinfo%\AppData\Roaming\Python\Python311\site-packages\dbsqlcli\sqlexecute.py", line 32, in connect

  conn = dbsql.connect(

      ^^^^^^^^^^^^^^

 File "%userinfo%\AppData\Roaming\Python\Python311\site-packages\databricks\sql\__init__.py", line 50, in connect

  return Connection(server_hostname, http_path, access_token, **kwargs)

      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 File "%userinfo%\AppData\Roaming\Python\Python311\site-packages\databricks\sql\client.py", line 189, in __init__

  self._session_handle = self.thrift_backend.open_session(

              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 File "%userinfo%\AppData\Roaming\Python\Python311\site-packages\databricks\sql\thrift_backend.py", line 464, in open_session

  response = self.make_request(self._client.OpenSession, open_session_req)

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 File "%userinfo%\AppData\Roaming\Python\Python311\site-packages\databricks\sql\thrift_backend.py", line 393, in make_request

  self._handle_request_error(error_info, attempt, elapsed)

 File "%userinfo%\AppData\Roaming\Python\Python311\site-packages\databricks\sql\thrift_backend.py", line 261, in _handle_request_error

  raise network_request_error

3 REPLIES 3

Anonymous
Not applicable

@John Zajic​ 

@John Zajic​ 

The error message "Error during request to server: [Errno 11001] getaddrinfo failed" suggests that there is a problem with resolving the hostname of the Databricks server. Here are some steps you can take to troubleshoot the issue:

  1. Check that the hostname in the host_name field of the dbsqlclirc file is correct. You can verify this by comparing it to the hostname displayed in the Databricks workspace URL.
  2. Check that your laptop is connected to the internet and has access to the Databricks server. You can test this by opening a web browser and navigating to the Databricks workspace URL.
  3. Check that there are no network restrictions or firewalls that may be preventing your laptop from connecting to the Databricks server. You can contact your IT department or network administrator to check this.
  4. Try pinging the Databricks server using the command prompt. Open the command prompt and type ping <hostname> (where <hostname> is the hostname of the Databricks server). This will test whether your laptop can reach the server.

Herkimer
New Contributor II

I hear what you are saying but I am using the same http_path and token when I run the databricks workspace ls which gives me a proper response.

Anonymous
Not applicable

Hi @John Zajic​ 

Thank you for posting your question in our community! We are happy to assist you.

To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?

This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance! 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.