diff options
author | root | 2014-02-19 15:42:35 -0600 |
---|---|---|
committer | root | 2014-02-19 15:42:35 -0600 |
commit | e1165a5d29bc435afd31f6a78061ea80203e9552 (patch) | |
tree | 799468b8e862ba49c108317a5e10a110e3413bf5 /wqflask/maintenance | |
parent | 65abf86206da02c682ca0ca3edcdf26519958cfd (diff) | |
download | genenetwork2-e1165a5d29bc435afd31f6a78061ea80203e9552.tar.gz |
Committer: root <root@alexandria.uthsc.edu>
On branch master
Diffstat (limited to 'wqflask/maintenance')
-rw-r--r-- | wqflask/maintenance/dataset/load_phenotypes.py | 29 | ||||
-rw-r--r-- | wqflask/maintenance/dataset/utilities.py | 4 |
2 files changed, 17 insertions, 16 deletions
diff --git a/wqflask/maintenance/dataset/load_phenotypes.py b/wqflask/maintenance/dataset/load_phenotypes.py index 6e7f049b..c47453b7 100644 --- a/wqflask/maintenance/dataset/load_phenotypes.py +++ b/wqflask/maintenance/dataset/load_phenotypes.py @@ -11,7 +11,7 @@ def main(argv): print "\t%s" % (str(item)) # var inbredsetid = config.get('config', 'inbredsetid') - cursor = utilities.get_cursor() + cursor, con = utilities.get_cursor() print "inbredsetid: %s" % inbredsetid # datafile datafile = open(config.get('config', 'datafile'), 'r') @@ -45,20 +45,21 @@ def main(argv): Phenotype.`Units`=%s """ cursor.execute(sql, ( - metarow[1], - metarow[2], - metarow[3], - metarow[4], - metarow[5], - metarow[6], - metarow[7], - metarow[8], - metarow[9], - metarow[18] + utilities.to_db_string_null(metarow[1]), + utilities.to_db_string_null(metarow[2]), + utilities.to_db_string_null(metarow[3]), + utilities.to_db_string_null(metarow[4]), + utilities.to_db_string_null(metarow[5]), + utilities.to_db_string_null(metarow[6]), + utilities.to_db_string_null(metarow[7]), + utilities.to_db_string_null(metarow[8]), + utilities.to_db_string_null(metarow[9]), + utilities.to_db_string_null(metarow[18]) )) - re = cursor.rowcount - print "INSERT INTO Phenotype: %d record" % re - + rowcount = cursor.rowcount + phenotypeid = con.insert_id() + print "INSERT INTO Phenotype: %d record: %d" % (rowcount, phenotypeid) + if __name__ == "__main__": print "command line arguments:\n\t%s" % sys.argv main(sys.argv) diff --git a/wqflask/maintenance/dataset/utilities.py b/wqflask/maintenance/dataset/utilities.py index e542cb43..fac24943 100644 --- a/wqflask/maintenance/dataset/utilities.py +++ b/wqflask/maintenance/dataset/utilities.py @@ -9,8 +9,8 @@ def get_cursor(): db = 'db_webqtl' con = MySQLdb.Connect(db=db, host=host, user=user, passwd=passwd) cursor = con.cursor() - return cursor - + return cursor, con + def clearspaces(s, default=None): if s: s = re.sub('\s+', ' ', s) |