web/hgbook/load_elements.py
changeset 0 8083d21c0020
equal deleted inserted replaced
-1:000000000000 0:8083d21c0020
       
     1 #!/usr/bin/env python
       
     2 #
       
     3 # This script updates the contents of the comments_element table.
       
     4 # It's fugly, but a lot less painful than trying to use Django's
       
     5 # fixtures system.
       
     6 
       
     7 import os, sys
       
     8 sys.path.append(os.path.dirname(__file__))
       
     9 import dbutil
       
    10 
       
    11 os.system('make -C ../../en all-ids.dat')
       
    12 
       
    13 conn = dbutil.connect()
       
    14 c = conn.cursor()
       
    15 c.execute('''load data local infile "../../en/all-ids.dat" replace
       
    16              into table comments_element
       
    17              fields terminated by "|"''')
       
    18 print 'Database updated'