Beispiel #1
0
def hgSqlConnect(db, config=None, **kwargs):
    " connect using information parsed from ~/.hg.conf "
    if config==None:
        config = maxCommon.parseConfig("~/.hg.conf")
    conn = MySQLdb.connect(host=config["db.host"], user=config["db.user"], \
        passwd=config["db.password"], db=db, **kwargs)
    return conn
Beispiel #2
0
def hgSqlConnect(db, config=None, **kwargs):
    " connect using information parsed from ~/.hg.conf "
    if config == None:
        config = maxCommon.parseConfig("~/.hg.conf")
    conn = MySQLdb.connect(host=config["db.host"], user=config["db.user"], \
        passwd=config["db.password"], db=db, **kwargs)
    return conn
Beispiel #3
0
    def _getBlatServersFromHgCentral(self):
        config = maxCommon.parseConfig("~/.hg.conf")
        hgCentralDb = config["central.db"]
        conn = maxTables.hgSqlConnect(hgCentralDb, config=config)
        # | db      | host   | port  | isTrans | canPcr |
        # +---------+--------+-------+---------+--------+
        # | petMar2 | blat4b | 17839 |       0 |      1 | 
        dbList = ["'%s'" % db for db in self.dbList]
        dbStr  = ",".join(dbList)
        sql    = "SELECT db, host, port FROM blatServers WHERE db IN (%s) AND canPcr=1" % dbStr
        rows = maxTables.sqlGetRows(conn, sql)

        self.blatServers = {}
        for row in rows:
            host = row["host"]+".cse.ucsc.edu"
            self.blatServers[row["db"]] = (host, row["port"])
        logging.debug("Using blat servers: %s " % self.blatServers)