dataclass-csv icon indicating copy to clipboard operation
dataclass-csv copied to clipboard

Support to split object properties to separate columns.

Open liudonghua123 opened this issue 2 years ago • 0 comments

Say If I have the following classes for serialization to csv.

@dataclass
class Link:
    title: str
    url: str
    
@dataclass
class SearchResult:	
    paper_name: Link
    authors: list[Link]
    publication: Link

I want to split paper_name into paper_name.title and paper_name.url columns in the generated csv file.

See also https://github.com/dfurtado/dataclass-csv/issues/33#issuecomment-1314895347.

Maybe some annotation can be used on the classes of the property type to indicate the purpose.

liudonghua123 avatar Nov 16 '22 02:11 liudonghua123