SEESenv/web/hgbook/load_elements.py
changeset 2 52d12eb31c30
parent 0 8083d21c0020
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SEESenv/web/hgbook/load_elements.py	Fri Feb 12 01:11:21 2010 +0530
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+#
+# This script updates the contents of the comments_element table.
+# It's fugly, but a lot less painful than trying to use Django's
+# fixtures system.
+
+import os, sys
+sys.path.append(os.path.dirname(__file__))
+import dbutil
+
+os.system('make -C ../../en all-ids.dat')
+
+conn = dbutil.connect()
+c = conn.cursor()
+c.execute('''load data local infile "../../en/all-ids.dat" replace
+             into table comments_element
+             fields terminated by "|"''')
+print 'Database updated'