cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
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
Esteemed Contributor III
Esteemed Contributor III

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.

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.