Added raw query results to json

This commit is contained in:
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.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.
+6 -4
View File
@@ -8,8 +8,9 @@ printr = functools.partial(print, file=sys.stderr)
def dump(): def dump():
global db
statistics_text = [ 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"===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)." 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("```") print("```")
for view in db.get_views(): for view in db.get_views():
print(f"export/view-f{view['name']}.json") printr(f"export/view-{view['name']}.json")
with pathlib.Path(f"export/view-f{view['name']}.json").open("w+") as f: with pathlib.Path(f"export/view-{view['name']}.json").open("w+") as f:
json.dump(view, db.query(view['sql'])) with db.Db() as _db:
json.dump([dict(record) for record in _db.query("SELECT * FROM {}".format(view['name']))],f)