Get the partition variable in python recipe

subhash
subhash Registered Posts: 4 ✭✭✭✭

Hi,

I have a dataset in dataiku which is partitioned, I am looking for tips on how I can get the partition value in python which is set as part of running the recipe.

See screenshot attached for reference. Basically i'm trying to access the partition variable in code

Answers

  • Mattsco
    Mattsco Dataiker, Registered Posts: 125 Dataiker

    Hi Subhash,

    In the python you can use:

    dataiku.dku_flow_variables["DKU_DST_curr_date"]

    You can see available variables on the left panel from the python recipe and click on it to insert the code.

    Capture d’écran 2021-05-18 à 20.12.15.png

  • subhash
    subhash Registered Posts: 4 ✭✭✭✭

    Thanks @Mattsco
    but the variables it's disabled and I can't figure out a way to add a variable. All I want is to pick the curr_date i set as partition to process.

    Thanks for your help

  • Mattsco
    Mattsco Dataiker, Registered Posts: 125 Dataiker

    Hi Subhash,

    It's not disabled, it says: "Validate your code to get the list of substitution variables."
    So you must click on the validate button, on the left side of the RUN button, to get it.

    Capture d’écran 2021-05-19 à 09.44.34.png

Setup Info
    Tags
      Help me…