SEESenv/web/hgbook/load_elements.py
author amit@thunder
Fri, 12 Feb 2010 01:11:21 +0530
changeset 2 52d12eb31c30
parent 0 web/hgbook/load_elements.py@8083d21c0020
permissions -rwxr-xr-x
Virtual enviroment for SEES-hacks added ...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     1
#!/usr/bin/env python
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     2
#
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     3
# This script updates the contents of the comments_element table.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     4
# It's fugly, but a lot less painful than trying to use Django's
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     5
# fixtures system.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     6
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     7
import os, sys
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     8
sys.path.append(os.path.dirname(__file__))
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     9
import dbutil
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    10
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    11
os.system('make -C ../../en all-ids.dat')
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    12
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    13
conn = dbutil.connect()
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    14
c = conn.cursor()
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    15
c.execute('''load data local infile "../../en/all-ids.dat" replace
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    16
             into table comments_element
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    17
             fields terminated by "|"''')
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    18
print 'Database updated'