-
Notifications
You must be signed in to change notification settings - Fork 3
/
id-sizes.py
33 lines (30 loc) · 961 Bytes
/
id-sizes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import json
import os
import sys
sizes = []
with open("./database/json/table.json", encoding="utf8") as f:
# {
# "name": string,
# "path": string,
# "key_path": string,
# "name_path": string,
# "category": string
# }[]
tables = json.load(f)
for table in tables:
table["table"] = []
max_id = 0
with open("./database/json/" + table["path"] + "/table.json", encoding="utf8") as f:
# {
# "name": string,
# "path": string,
# "length": number,
# "key": string
# }[]
table["table"] = json.load(f)
for row_i, row in enumerate(table["table"]):
with open("./database/json/" + table["path"] + "/data/" + row["path"], encoding="utf8") as f:
data = json.load(f)
for d in data:
max_id = max(max_id, len(f"{table['path']},{row['key']},{d['id']}".encode("utf8")))
print(f"{table['name']}: {max_id}")