format file
This commit is contained in:
parent
43d6635be0
commit
b7668d19b9
7
main.py
7
main.py
@ -99,7 +99,7 @@ class DBConn:
|
||||
clients = pd.read_sql(f"SELECT * FROM \"{tbl}\"", self.con)
|
||||
clients.to_csv(args.output / f"{prefix}{tbl}.csv", index=False, sep=args.delimiter)
|
||||
|
||||
def extract_child(self, items_list, current_level, prev_step, existing, step):
|
||||
def extract_child(self, items_list, current_level, prev_step, existing):
|
||||
|
||||
attributes = existing.get("attributes", [args.join_column])
|
||||
flat_attributes = existing.get("flat_attributes", [])
|
||||
@ -124,7 +124,7 @@ class DBConn:
|
||||
existing_next_step = children.get(subKey, {})
|
||||
children[subKey] = self.extract_child(subValue, subKey,
|
||||
f"{prev_step}{current_level}_",
|
||||
existing_next_step, step + 1)
|
||||
existing_next_step)
|
||||
else:
|
||||
child_header = f"{current_level}_{subKey}"
|
||||
if child_header not in attributes:
|
||||
@ -190,9 +190,10 @@ class DBConn:
|
||||
child_attribute = f"{key}_{subKey}"
|
||||
if child_attribute not in attributes:
|
||||
attributes.append(child_attribute)
|
||||
|
||||
elif value_is_list:
|
||||
existing = children.get(key, {})
|
||||
children[key] = self.extract_child(value, key, f"{top_level}_", existing, 1)
|
||||
children[key] = self.extract_child(value, key, f"{top_level}_", existing)
|
||||
else:
|
||||
if key not in attributes:
|
||||
attributes.append(key)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user