feat: add raw query results to json export for each view using new Db context manager
This commit is contained in:
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
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.
@@ -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)
|
||||
Reference in New Issue
Block a user