Added support for view exports

This commit is contained in:
retoor 2024-11-24 07:38:33 +01:00
parent aeb6b1a635
commit f62e6a58df

View File

@ -70,7 +70,7 @@ def dump():
print(line) print(line)
print("```") print("```")
for view in db.get_views(): for view in db.get_views():
print(f"export/view-f{view['name']}.json") print(f"export/view-f{view['name']}.json")
with pathlib.Path(f"export/view-f{view['name']}.json").open("w+") as f: with pathlib.Path(f"export/view-f{view['name']}.json").open("w+") as f:
json.dump(view, db.query(view['sql'])) json.dump(view, db.query(view['sql']))