โ11-25-2021 05:31 AM
I already saw this post
I want my code to work on both platforms (Databricks and PyCharm), is there any way to do it?
โ11-25-2021 05:37 AM
yes.
one way is to develop everything locally on your pc, so you also need to have spark installed.
This is of course not ideal as you will not have some interesting stuff that databricks provides.
But it can be done. What you have to do is create a whl and put that on databricks.
A much better way imo is to use databricks-connect. This tool enables you to use your IDE (pycharm) and let the code run on databricks, not locally:
https://docs.microsoft.com/en-us/azure/databricks/dev-tools/databricks-connect
Mind that the databricks-connect devs don't follow the ultrafast release schedule of the databricks platform.
Since a short while you can also use Databricks repos for modules and functions:
https://docs.microsoft.com/en-us/azure/databricks/repos#work-with-python-and-r-modules
โ11-25-2021 05:37 AM
yes.
one way is to develop everything locally on your pc, so you also need to have spark installed.
This is of course not ideal as you will not have some interesting stuff that databricks provides.
But it can be done. What you have to do is create a whl and put that on databricks.
A much better way imo is to use databricks-connect. This tool enables you to use your IDE (pycharm) and let the code run on databricks, not locally:
https://docs.microsoft.com/en-us/azure/databricks/dev-tools/databricks-connect
Mind that the databricks-connect devs don't follow the ultrafast release schedule of the databricks platform.
Since a short while you can also use Databricks repos for modules and functions:
https://docs.microsoft.com/en-us/azure/databricks/repos#work-with-python-and-r-modules
โ11-25-2021 05:53 AM
Yes I've used Databricks-connect to do so.
When I work with pychram '%run' doesn't work but 'import' do, when I work with Databricks 'import' doesn't but '%run' do.
How can I resolve this?
โ11-25-2021 05:56 AM
Never mind I found that I need to use 'Files' to do so, Thanks ๐
โ09-19-2022 01:00 AM
Hi @Avner Huriโ ,
Would you mind elaborating on what you mean by using 'Files'?
It seems I have the same challenge:
1) I already use databricks-connect
2) I still have an issue exploring some notebooks in Pycharm because %run magic is not treated as an import
โ09-19-2022 01:14 AM
Files - if you want to 'import' command to Import code to your notebook, your code must be in a 'File'(this is his name on the Databricks UI) if you want to import a notebook you have to use %run
yes the %run command is a problem, I didn't try to solve it just didn't use it in places that must have it.
but I thunk you can just create a wrapper class that use %run when you are on Databricks and import otherwise.
โ09-19-2022 10:08 AM
Oh k, thanks.
That wrapper idea is interesting, maybe I could do something like that.
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