view web/hgbook/load_elements.py @ 748:d13c7c706a58

Merge with http://hg.serpentine.com/mercurial/book
author Dongsheng Song <dongsheng.song@gmail.com>
date Fri, 20 Mar 2009 15:40:06 +0800
parents ad304b606163
children 188efaefe001
line wrap: on
line source

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

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'