web/hgbook/load_elements.py
changeset 2 52d12eb31c30
parent 1 672eaaab9204
child 3 6cee07c589cb
equal deleted inserted replaced
1:672eaaab9204 2:52d12eb31c30
     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'