How to select partition on R Jupyter Notebook.

CD
CD Registered Posts: 5 ✭✭✭✭

Hello,

If I want to use a date range as partition on dkuReadDataset for a R Jupyter Notebook, how would it be?

dkuReadDataset("SourceData", partitions="?" )

Like partitions ="2021-01-01/2021/06/01" ?

https://doc.dataiku.com/dss/api/8.0/R/dataiku/reference/dkuReadDataset.html

Answers

  • Sarina
    Sarina Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 317 Dataiker
    edited July 17

    Hi @CD
    ,

    You can get the available partition values in an R notebook using the dkuListDatasetPartitions method. For example, on my dataset with two partitions:

    Screen Shot 2021-07-08 at 4.31.01 PM.png

    Then you can simply pass an exact partition value to the dkuReadDataset function, like this:

    transactions_copy <- dkuReadDataset("transactions_copy", partitions='2018')
    


    If you want to specify multiple partitions, you can specify them in the same way that you would specify them in a recipe when selecting partitions. So they can be comma-separated to specify explicit values, or slash-separated to specify a range:

    # this will return the explicit partitons 2017-03 and 2017-07
    transactions_copy <- dkuReadDataset("transactions_copy", partitions="2017-03,2017-07")
    
    # this will return the range of partitions between 2017-03 and 2017-07
    transactions_copy <- dkuReadDataset("transactions_copy", partitions="2017-03/2017-07")

    Let me know if you have any questions about this.


    Thank you,
    Sarina

Setup Info
    Tags
      Help me…