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:ย 

Is there a way to add docstring to user defined functions in databricks?

hitesh22
New Contributor II
 
5 REPLIES 5

pvignesh92
Honored Contributor

@Hitesh Agarwalโ€‹ Hi. AFAIK, I don't see any examples with docstring in udf. We just add the comments using typical comment way. Is there anything in particular, you want to achieve using docstring?

hitesh22
New Contributor II

@Vigneshraja Palanirajโ€‹ Hi, normal VS Code we can add docstring to python code but I was unable to do the same in databricks. After the latest updates in databricks we get auto-completion feature, also, when you hover over a system defined function there's a dialog box which gives you function definition, basic info and function return type. I wanted to achieve the same with user defined functios using docstring

pvignesh92
Honored Contributor

Hi @Hitesh Agarwalโ€‹ Yes I get that. I don't see anything like that available yet. Let us see if any new feature is available for the same in upcoming releases.

Debayan
Databricks Employee
Databricks Employee

Hi, I am not sure if this helps: https://www.databricks.com/blog/2020/12/15/python-autocomplete-improvements-for-databricks-notebooks...

Also, please tag @Debayanโ€‹ with your next response which will notify me. Thank you!

hitesh22
New Contributor II

@Debayan Mukherjeeโ€‹ I have gone through this article and this doesn't helps as it mentions how to see docstrings for a system defined function but not how to add docstrings to user defined functions.

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