0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-30 10:42:47 +01:00
construct/tools/synapse.db.py

24 lines
434 B
Python
Raw Normal View History

#!/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)