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:
parent
00ac048e68
commit
631991895b
1 changed files with 23 additions and 0 deletions
23
tools/synapse.db.py
Executable file
23
tools/synapse.db.py
Executable 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)
|
Loading…
Reference in a new issue