Troubleshooting `ImportError: cannot import name 'ExecuteStatementResponse'` with Databricks SDK

Original Slack Thread

<@U06TM7M40RK> ImportError: cannot import name ‘ExecuteStatementResponse’ from ‘databricks.sdk.service.sql’

The error you’re encountering, ImportError: cannot import name 'ExecuteStatementResponse' from 'databricks.sdk.service.sql', is due to a change in the Databricks SDK where the ExecuteStatementResponse class was removed in version 0.30.0. This is a known issue when using the DataHub Unity Catalog plugin, which expects this class to be present.

To resolve this issue, you can take the following steps:

  1. Downgrade the Databricks SDK: You need to use a version of the Databricks SDK that still includes the ExecuteStatementResponse class. You can downgrade to a version prior to 0.30.0. For example:

    pip install 'databricks-sdk<0.30.0'
    
  2. Modify Docker or Environment Setup: If you are using Docker or a specific environment setup, ensure that the correct version of the Databricks SDK is installed. You can modify your Dockerfile or environment setup to include the specific version of the SDK.

  3. Check for Updates: Ensure that you are using the latest version of DataHub that might have addressed this issue. According to <Issues · datahub-project/datahub · GitHub GitHub issue>, the problem was fixed in a later version of DataHub CLI (0.14.0).

Would you like more detailed steps on any of these troubleshooting points or further assistance on a specific part of the process?

Sources:

<@U06TM7M40RK> same error after running pip install ‘databricks-sdk<0.30.0’

If you’re still encountering the same error after downgrading the Databricks SDK to a version below 0.30.0, there might be a few additional steps to consider:

  1. Verify the Installed Version: Ensure that the correct version of the Databricks SDK is installed. You can check the installed version by running:

    pip show databricks-sdk
    

    Make sure the version is indeed below 0.30.0.

  2. Clear Environment Cache: Sometimes, Python environments can cache packages. Try clearing the cache or creating a new virtual environment to ensure that the correct version is being used.

  3. Reinstall DataHub: After downgrading the Databricks SDK, it might be necessary to reinstall DataHub to ensure compatibility with the downgraded SDK:

    pip uninstall acryl-datahub
    pip install acryl-datahub[unity-catalog]
    
  4. Check for Conflicting Dependencies: Ensure there are no other packages that might be causing a conflict with the Databricks SDK. You can use tools like pipdeptree to inspect the dependency tree.

  5. Review Docker or Environment Setup: If you are using Docker, ensure that the Dockerfile is correctly set up to install the specific version of the Databricks SDK. You might need to rebuild the Docker image after making changes.

  6. Check for DataHub Updates: Ensure that you are using a version of DataHub that is compatible with the Databricks SDK. As mentioned earlier, the issue was addressed in DataHub CLI version 0.14.0.

Would you like more detailed steps on any of these troubleshooting points or further assistance on a specific part of the process?

Sources:

Hi :slight_smile: ! Did this interaction resolve your issue or do you still require assistance ?

Please tag @ RunLLM if you still need further assistance !

Or tag @Datahub Community Support if you require a person to take a look :slight_smile:

Hope this helps ! ><