start adding arg parse to make it extendable

This commit is contained in:
gowthaman 2023-06-16 05:25:30 +05:30
parent bfc0f9c7b4
commit 3365e5f87d

11
main.py
View File

@ -1,6 +1,17 @@
import pathlib
import ijson
import sqlite3
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"]
extract_keys = {