-
Notifications
You must be signed in to change notification settings - Fork 1
/
leda_operations.py
43 lines (32 loc) · 1.29 KB
/
leda_operations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import MySQLdb as mdb
import edd
import EDD_config
# connect to mysql database
try:
db=mdb.connect(EDD_config.host,user=EDD_config.user,passwd=EDD_config.passwd,db=EDD_config.database)
except:
print "There was an error in connecting to the database"
exit(1)
print "EDD: generation of Leda related files"
answer=edd.query_yes_no("Would you like to query the database in Lion to regenerate Leda from scratch?",default="no")
if (answer=="yes"):
answer=edd.query_yes_no("Are you sure you want to continue (it will take about 1 hour to finish) ?", default="no")
if (answer=="yes"):
edd.drop_leda_table(db)
#edd.define_leda_columns(db)
edd.create_leda_table(db)
# Retrieve the list of pgc numbers
print "Retrieving pgc list from database..."
cur=db.cursor()
cur.execute('SELECT pgc from pgc;')
results=cur.fetchall()
#print results
pgcs = [x[0] for x in results]
#pgcs=[12439,12446]
#print pgcs
cur.close()
edd.generate_kleda_orig_from_lyon(db,pgcs)
edd.copy_leda_orig_into_leda(db)
answer=edd.query_yes_no("Would you like to generate a new leda bar file from the current kleda in the database?",default="no")
if (answer=="yes"):
edd.generate_leda_bar_file(db)