Skip to content

Commit

Permalink
Hierarchical metadata import properly updates tables
Browse files Browse the repository at this point in the history
  • Loading branch information
bmschmidt committed Jul 10, 2015
1 parent 5cb4601 commit 34ccae5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bookworm/variableSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,12 @@ def loadMetadata(self):
#This creates the main (slow) catalog table
db.query("""DROP TABLE IF EXISTS %s """ % self.tableName)
createcode = """CREATE TABLE IF NOT EXISTS %s (
""" %self.tableName + ",\n".join(mysqlfields) + ") ENGINE=MYISAM;"
db.query(createcode)
""" % self.tableName + ",\n".join(mysqlfields) + ") ENGINE=MYISAM;"
try:
db.query(createcode)
except:
print createcode
raise
#Never have keys before a LOAD DATA INFILE
db.query("ALTER TABLE %s DISABLE KEYS" % self.tableName)
print "loading data into %s using LOAD DATA LOCAL INFILE..." % self.tableName
Expand Down Expand Up @@ -718,6 +722,9 @@ def updateMasterVariableTable(self):
we store the create code in the databse;
"""
for variable in self.variables:
# Make sure the variables know who their parent is
variable.fastAnchor = self.fastAnchor
# Update the referents for everything
variable.updateVariableDescriptionTable();

inCatalog = self.uniques()
Expand Down

0 comments on commit 34ccae5

Please sign in to comment.