示例#1
0
def connect():
    global db
    db = webpy_db.database(port=port,
                           host=host,
                           dbn='postgres',
                           db=the_db,
                           user=user,
                           pw=pw)
    print '开始连接数据库 %s' % host
示例#2
0
文件: test_pg.py 项目: Jasonfloy/lib
def connect():
    global db
    db = webpy_db.database(
        port=5432,
        host=DB_IP,
        dbn='postgres',
        db='base',
        user='******',
        pw='base')
    print '开始连接数据库 %s' % DB_IP
示例#3
0
def connect():
    global db
    db = webpy_db.database(
        port=5432,
        host=host,
        dbn='postgres',
        db=the_db,
        user=user,
        pw=pw)
    print '开始连接数据库 %s' % host
示例#4
0
文件: shard.py 项目: xianhuawei/utils
 def gen_db(self, node_cfg):
     pool_policy = node_cfg.get('pool_policy', 'default')
     node_cfg['pooling'], node_cfg['dbn'] = True, 'mysql'
     node_cfg.update(_pool_policy[pool_policy])
     if 'port' in node_cfg:
         node_cfg['port'] = int(node_cfg['port'])
     else:
         node_cfg['port'] = 3306
     return database(
         **{k: v
            for k, v in node_cfg.items() if k not in _config_fields})