Added raw query results to json

This commit is contained in:
retoor 2024-11-24 08:02:32 +01:00
parent f62e6a58df
commit a54c800051
7 changed files with 409 additions and 4 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

(image error) Size: 1.9 MiB

After

(image error) Size: 1.9 MiB

View File

@ -8,8 +8,9 @@ printr = functools.partial(print, file=sys.stderr)
def dump():
global db
statistics_text = [
f"===devRant(developer community) haves {db.get_user_count()} active users(ranters)."
f"===devRant(developer community) has {db.get_user_count()} active users(ranters)."
f"===All users(ranters) of devRant together did contribute {db.get_contribution_count()} times in total."
f"===The average user(ranter) of devrant(developer community) contributed {db.get_contribution_average_per_user()} times on devrant(developer community)."
]
@ -71,6 +72,7 @@ def dump():
print("```")
for view in db.get_views():
print(f"export/view-f{view['name']}.json")
with pathlib.Path(f"export/view-f{view['name']}.json").open("w+") as f:
json.dump(view, db.query(view['sql']))
printr(f"export/view-{view['name']}.json")
with pathlib.Path(f"export/view-{view['name']}.json").open("w+") as f:
with db.Db() as _db:
json.dump([dict(record) for record in _db.query("SELECT * FROM {}".format(view['name']))],f)