Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Added on March 14, 2022 11:02AM
Likes: 0
Replies: 2
Hi Team,
We have been trying to build a code where we need to identify recipes which has an output partitioned dataset. We tried couple of approaches to achieve this:
Drawback with 2nd approach is, list_paritions() is taking too long a time to execute.
Could you please help us identify if there is any other way or direct API/identifier in recipe details that tells us whether it has a partitioned dataset or not?
Hi @nmadhu20
,
I think that a modification using parts of the first and second approach will work, where you get the partitioning field from the dataset settings to determine if the dataset is partitioned.
Here is an example:
for dataset in project.list_datasets(as_type='object'): settings = dataset.get_settings() raw_settings = settings.get_raw() # get the 'partitioning' field and check that length of dimensions is > 0 if 'partitioning' in raw_settings: if len(raw_settings['partitioning']['dimensions']) > 0: # check if this is an output dataset to a recipe dataset_usages = dataset.get_usages() for usage in dataset_usages: if usage['type'] == 'RECIPE_OUTPUT': print('dataset: ' , dataset.name, 'recipe: ', usage['objectId'])
Let me know if you have any questions about this approach.
Thanks,
Sarina
Yes, thankyou this worked for me.