0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 00:02:34 +01:00

tools: Add very preliminary synapse db dump tool.

This commit is contained in:
Jason Volk 2017-11-06 12:24:27 -08:00
parent 00ac048e68
commit 631991895b

23
tools/synapse.db.py Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/python
import os
import sys
if len(sys.argv) < 2:
print "Usage: %s <sqlite3 dump file>" % sys.argv[0]
sys.exit(1)
file = sys.argv[1];
for line in open(file):
if not line.startswith("INSERT"):
continue
line = line.split(" ", 3)
line = line[3].rstrip(");\n")
line = line.lstrip("VALUES(")
line = line.split(",", 2)
line = line[2].split("',", 1)
line = line[1].strip("\\'")
sys.stdout.write(line)
sys.exit(0)