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
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.

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!