view web/hgbook/load_elements.py @ 838:d1f676a6a4b3 default tip

update mq chapter. propagate ef53d025f410.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 03 Dec 2009 01:26:08 +0900
parents 188efaefe001
children
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 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'