New issue 419: how to extend precanned csv import extract method to add csv 
source to __source__ metadata

https://bitbucket.org/blais/beancount/issues/419/how-to-extend-precanned-csv-import-extract



Jeff Mondoux:



I have a custom importer to import my banks csv statements, this imported 
inherits from beancount csv importer in which I override the extract\(\) method 
as such:



```

def extract(self, file, existing_entries=None):

    mapped_account = self.file_account(file)

    entries = super().extract(file, existing_entries)

    for entry in entries:

        entry.meta['__source__']='source'

    return entries

```



What I can’t figure out with my limited python abilities is how can I add the 
raw csv line to the \_\_**source**\_\_ metadata field so that it can be 
displayed by fava import gui.  I want to avoid rolling my own csv importer 
entirely as the generic csv importer provided by beancount does what I need for 
the most part.  I know I can reread the csv file a second time to append the 
data, but is this the best or only way?




-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20200214172331.25371.90037%40celery-worker-108.ash1.bb-inf.net.

Reply via email to