def export_json(repo, tables=[], output_path='./json'):
json_data = []
try:
f = open(output_path + "/EXPORT.JSON", "a")
for tab in tables:
database_name = tab[0]
schema_name = tab[1]
table_name = tab[2]
data = repo.get_table(database_name, schema_name, table_name)
json_data.append(data)
f.write(json.dumps(json_data, indent=2).encode('utf-8'))
f.close()
log.info(_("Generated JSON file."))
except IOError, e:
log.error(_("Could not generate JSON file."))
sys.exit(1)
return True
评论列表
文章目录