datafiles
datafiles copied to clipboard
Support class relationships and foreign keys
datafiles package is great, but it stops short of providing support for object relationships and foreign keys. is that feature anywhere on the horizon? if not, would you be open to discussing it and providing guidance on how to implement it?
That's an interesting idea. Perhaps you could provide some pseudocode of how it might look to use such a feature?
Great package @jacebrowning, congrats!
This request could be done like this:
from dataclasses import dataclass
from datafiles import datafile
@datafile("parents/{self.name}/metadata.yml")
@dataclass
class Parent:
name: str
@datafile("parents/{self.parent.name}/items/{self.name}/metadata.yml")
@dataclass
class Item:
name: str
parent: Parent
count: int
available: bool
It works fine for me!