Draft: Do not build element dicts but element rows for CSV export
-
Make it actually work 🙂 things are not in the right order probably because this cool looking thingfor column in metadata_columns: element_row.append( next( (item.value for item in element_md if item.name == column), None, ) )
if with_metadata and metadata_columns: element_md = element_metadata(item.id, load_parents=with_parent_metadata) # For each column name append metadata value or an empty string in the correct column order for column in sorted(set(metadata_columns)): mds = [md.value for md in element_md if md.name == column] column_count = len([col for col in metadata_columns if col == column]) assert len(mds) <= column_count, "Metadata and column count mismatch" i = 1 for md in mds: element_row.append(md.value) i += 1 while i < column_count: element_row.append("")
-
tests -
docs