Closed slhck closed 5 years ago
You will note that the import_xslx
code is mostly unchanged, so you can add your logic there. The same goes for import_csv
. Ideally there should not be a lot of repetition in these two functions.
PS: Why "ingest"? Since import
is a reserved Python name :)
Sounds great @slhck, thank you! Let me take a look at it and merge it with the master branch. 😊
Great!
I will work on the “export to CSV” function and some general usability stuff (like configuration) once it's merged. I'm thinking about providing better defaults as well, so you don't have to write too large config files. I think it would be best if we also started to collect more working examples that we can provide.
Closed in favor of #12
This addresses a couple of things.
Now, eveything lives in a
sujson
package. It can be installed withpip3 install .
and you can then callsujson
from the command line.As for code layout: The
__main__.py
code is responsible for all things that have to do with the command line. The_sujson.py
code with itsSujson
class instead is only responsible for actual data processing. That means in the future someone could just import theSujson
class and do transformations without going through CLI. Hence, it's important that the Sujson class takes all necessary configuration via arguments passed to its functions. As you can see, the class can "remember" stuff that may be useful for different calls. For example, you may read in some data, transform it, and output it multiple times in different formats.Ideally, in the future, the configuration could be moved out of the config file and into function arguments. For example, the
import_xslx
function should have an option to specifysheet_hdr_name
etc.Example run:
Some additional info:
-v
and-d
switches to print more info