https://kedro.org/ logo
#questions
Title
# questions
j

Jan

12/07/2022, 9:30 AM
Hello! Is it possible to register a data catalog entry as a versioned file (versioned=True) via kedro.io.DataCatalog ? I only find information about how to do this in the yml file.
s

Shubham Gupta

12/07/2022, 9:31 AM
Yes! All the kwargs can be passed exactly the way you can in catalog.yml
j

Jan

12/07/2022, 9:34 AM
How exactly?
Copy code
io = DataCatalog(
    {
        "myfile": ExcelDataSet(filepath="path/to/file.xlsx", versioned=True),
    }
)
This gives me
TypeError: __init__() got an unexpected keyword argument 'versioned'
😕
n

Nicolas Oulianov

12/07/2022, 9:44 AM
The keyword argument to Excel dataset should be « load_args » ! And then, I guess as a value a dictionary with versioned:true
j

Jan

12/07/2022, 9:51 AM
Not working. I also tried to set
save_args
because I guess that would make sense but it gives another error. I don't think versioning is activated that way 🤔
n

Nicolas Oulianov

12/07/2022, 12:58 PM
There is a version parameter in the ExcelDataSet, but it’s not just a bool. 🤔
j

Jan

12/08/2022, 7:15 AM
Thanks! It's working with
ExcelDataSet(filepath='path/etc/file.xlsx', version=Version(load=None, save=None))
where Version is imported from
<http://kedro.io|kedro.io>
. This will use the default behaviour for versioning 🙂
4 Views