databricks-cli icon indicating copy to clipboard operation
databricks-cli copied to clipboard

Python files being to converted to notebooks when using Databricks CLI

Open sachamourier96 opened this issue 1 year ago • 7 comments

Hello, I am using the attached piece of code to import both notebooks and python files from my git repo, and am writing them to a Workspace folder. However, when running the attached code, all of my Python files get converted to notebooks, which is not what I want. I have tried several approaches but still cannot manage to make it work. Has someone found a way to avoid this convertion? I want my Python files to remain Python files to be able to use them as Python modules. Thanks a lot in advance, Sacha

Screenshot 2024-09-22 111325

sachamourier96 avatar Sep 22 '24 09:09 sachamourier96

You need to use new CLI! https://github.com/databricks/cli & https://docs.databricks.com/en/dev-tools/cli/install.html

From the docs:

The legacy Databricks CLI is in an Experimental state. Databricks plans no new feature work for the legacy Databricks CLI at this time.

alexott avatar Sep 23 '24 06:09 alexott

Hi @alexott, I have tried to use the latest version but it seems like I am unable to use a version that's above 0.18. Do you have a way to go through this issue ? Thanks for your help, Sacha

sachamourier96 avatar Sep 23 '24 06:09 sachamourier96

new CLI isn't Python based - follow the documentation on how to install it

alexott avatar Sep 23 '24 06:09 alexott

@alexott I still have not really been able to find a solution. Is there a way to use the new CLI within an Azure DevOps pipeline the way that's shown on my screenshot ? Thanks for the help !

sachamourier96 avatar Jan 06 '25 15:01 sachamourier96

you can achieve the same, just install it differently: https://github.com/alexott/dabs-playground/blob/main/jdemo/azure-pipelines.yml#L48

alexott avatar Jan 06 '25 15:01 alexott

The installation indeed worked ! However, for the rest, I get "databricks command not found" errors when trying to configure the CLI.

sachamourier96 avatar Jan 06 '25 16:01 sachamourier96

you still need to import corresponding env because brew put it's into it's own folder

alexott avatar Jan 06 '25 16:01 alexott