Comments in Formula

User Story:

As a creator of formulas in Dataiku, I would like to be able to add comments in formulas, this would allow me to leave information in formulas about why formulas are configured the way that they are, increasing trust and communications, and it would allow the ability to "comment out" chunks of code while testing and debugging saving analyst and data scientist time.

Conditions of Satisfaction:

  • The Formula Editors should correctly highlight comments as comments.
  • Comments should be valid mid line commenting out anything after the comment start string
  • Documentation should be updated to reflect the ability to create comments in formulas

Nice to Have:

  • It would be great if there were both line based comments and block based comments.

Notes:

I've tried SQL like "--" and " /* */ ", Python line comments "#", Java line comments '//'

--Tom
5 Comments
apichery
Dataiker

Hi Tom,

Thanks for the feedback. We'll add this feature request to our backlog.

Status changed to: In the Backlog

Hi Tom,

Thanks for the feedback. We'll add this feature request to our backlog.

apichery
Dataiker

In the meantime, if you are using your formula in a Prepare recipe, you can add a comment in the step by clicking this button. This is not quite as powerful as comments directly in the code but this might help.

prepare.png

โ€ƒ

In the meantime, if you are using your formula in a Prepare recipe, you can add a comment in the step by clicking this button. This is not quite as powerful as comments directly in the code but this might help.

prepare.png

โ€ƒ

@apichery ,

I have been using the Step notes for a while now.  And they are helpful. 

However, the real place I miss having "inline" comments is when working on / debugging a multi-line complicated formula. I find myself wanting to "comment out" section of a formula to debug small pieces of the formula.  Now I have to copy out the original formula to a text editor, then copy chunks of the formula to see what each section of the formula is doing.  Find the bug and re-integrate it into the longer formula.  My formulas are not very complicated.  Here is sort of a made up example.

if( and( coalesce(item_ages_between_18_and_26_months, 'false')
, diff(coalesce(closes_on, submitted_at, created_at)
, coalesce(item_created_date, created_at)
, 'months'
) <= ${Minimum_age_by_close_on_dt}
, or(coalesce(current_product_state, 'false')
,contains(current_status, 'legacy')
)
)
, inc(coalesce(submitted_at, created_at),-25,'months')
, create_dt
)

Finding out that I needed to uses some coalesce() in this to take care of missing data took a bit of work.  Being able to comment out and check things would have helped.

I also feel that I would use inline comments for noting which things take care of items in the description in the item notes.  Inline I might say why I coalesce to the specific value I used.  

Just my $0.02 for the evening.  Hope this further details helps.

--Tom

@apichery ,

I have been using the Step notes for a while now.  And they are helpful. 

However, the real place I miss having "inline" comments is when working on / debugging a multi-line complicated formula. I find myself wanting to "comment out" section of a formula to debug small pieces of the formula.  Now I have to copy out the original formula to a text editor, then copy chunks of the formula to see what each section of the formula is doing.  Find the bug and re-integrate it into the longer formula.  My formulas are not very complicated.  Here is sort of a made up example.

if( and( coalesce(item_ages_between_18_and_26_months, 'false')
, diff(coalesce(closes_on, submitted_at, created_at)
, coalesce(item_created_date, created_at)
, 'months'
) <= ${Minimum_age_by_close_on_dt}
, or(coalesce(current_product_state, 'false')
,contains(current_status, 'legacy')
)
)
, inc(coalesce(submitted_at, created_at),-25,'months')
, create_dt
)

Finding out that I needed to uses some coalesce() in this to take care of missing data took a bit of work.  Being able to comment out and check things would have helped.

I also feel that I would use inline comments for noting which things take care of items in the description in the item notes.  Inline I might say why I coalesce to the specific value I used.  

Just my $0.02 for the evening.  Hope this further details helps.

fho
Level 2

Upvote, because in my first simple recipe I naturally wrote # then // into a formula and was surprised it didn't work ๐Ÿ™‚ I always write a comment first, when writing non-trivial code, to check if my code does what I wanted it to do ๐Ÿ˜‰ Inline comments are also helpful for traceability if you'd like e.g. add IDs of related requirements or tickets.

Upvote, because in my first simple recipe I naturally wrote # then // into a formula and was surprised it didn't work ๐Ÿ™‚ I always write a comment first, when writing non-trivial code, to check if my code does what I wanted it to do ๐Ÿ˜‰ Inline comments are also helpful for traceability if you'd like e.g. add IDs of related requirements or tickets.

@fho ,

thanks for upvoting the idea.   

--Tom

@fho ,

thanks for upvoting the idea.