示例#1
0
def mkcon(s='my'):
    try:
        if s == 'my':
            mconn = connector.connect(**mconf)
            logger.info('Building connection to Mysql...')
        elif s == 'mic':
            mconn = connect(micfg)
            logger.info('Building connection to Micsql...')
        else:
            raise Exception('Bad config for make connection to SQL')
        cursor = mconn.cursor()
    except:
        logger.exception('Failure Information!')
        logger.info('CONN Failure!')
    return (cursor, mconn)
示例#2
0
def pall(cursor):
    rows = cursor.fetchall()
    logger.debug('rows:' + str(len(rows)))
    for i in rows:
        logger.info(i)
    return rows
示例#3
0
def pd(cursor, b=10):
    rows = cursor.fetchmany(b)
    logger.debug('rows:' + str(len(rows)))
    for i in rows:
        logger.info(i)
    return rows