Hi! is there a way to show the list of all the ver...
# beginners-need-help
i
Hi! is there a way to show the list of all the versions of a dataset in the catalog?
a
It's a bit hacky but something like this should work:
Copy code
pattern = str(dataset._get_versioned_path("*"))
        version_paths = sorted(dataset._glob_function(pattern))
(assuming you're trying to do this through Python... otherwise just
ls
the directory or something like that)
i
Thanks !
I will give it a try right now
the _get_versioned_path is what I was looking for 🙂
It's working fine! thanks! I wrapped it in a function in case one needs it :
Copy code
import pathlib
def get_all_versions_of_a_dataset(dataset_name):
    dataset = catalog._get_dataset(dataset_name)
    pattern = dataset._get_versioned_path("*")
    paths = dataset._glob_function(pattern)
    return [pathlib.Path(i).parent.name for i in paths]
get_all_versions_of_a_dataset("dataset_name")