start adding arg parse to make it extendable
This commit is contained in:
parent
bfc0f9c7b4
commit
3365e5f87d
11
main.py
11
main.py
@ -1,6 +1,17 @@
|
|||||||
|
import pathlib
|
||||||
|
|
||||||
import ijson
|
import ijson
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("-i", "--input", help="folder containing input json(s)", required=True, type=pathlib.Path)
|
||||||
|
parser.add_argument("-o", "--output", help="folder to place csv", required=True, type=pathlib.Path)
|
||||||
|
parser.add_argument("-s", "--single", action="store_true", help="merge all json files to single output csv")
|
||||||
|
parser.add_argument("-j", "--join-column", help="join column from top-level to merge nested json", required=True)
|
||||||
|
parser.add_argument("-m", "--metadata", type=int, help="how many records to parse for building metadata", default=100)
|
||||||
|
parser.parse_args()
|
||||||
|
|
||||||
flat_keys = ["cost_center", "location", "customer"]
|
flat_keys = ["cost_center", "location", "customer"]
|
||||||
extract_keys = {
|
extract_keys = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user