How can create a variable with the name of the month?

Options
DvMg
DvMg Registered Posts: 10 ✭✭✭✭
Hi All

I want to create a variable with the name of the actual month for it will be the subject of my email reporter.

How can do it?

Thanks
Tagged:

Best Answer

  • Mattsco
    Mattsco Administrator, Dataiker Posts: 125 Administrator
    Answer ✓
    Options
    Hi DvMg,

    In a python recipe you can use this code to set the project variable at the name of current month. You'll have to rerun it every month with a scenario.


    import dataiku
    from datetime import datetime

    projectKey = dataiku.get_custom_variables()["projectKey"]
    c = dataiku.api_client()
    p = c.get_project(projectKey)
    v = p.get_variables()
    v["standard"]["current_month"] = datetime.now().strftime('%B')
    p.set_variables(v)
Setup Info
    Tags
      Help me…