Comments in Formula

tgb417
tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,598 Neuron

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 '//'

10
10 votes

In the Backlog · Last Updated

Comments

  • apichery
    apichery Dataiker, Alpha Tester, Registered, Product Ideas Manager, Moderator Posts: 62 Dataiker

    Hi Tom,

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

  • apichery
    apichery Dataiker, Alpha Tester, Registered, Product Ideas Manager, Moderator Posts: 62 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

  • tgb417
    tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,598 Neuron
    edited July 17

    @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
    fho Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Registered Posts: 3

    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.

  • tgb417
    tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,598 Neuron

    @fho
    ,

    thanks for upvoting the idea.

Setup Info
    Tags
      Help me…