• mysql 执行长sql


    import MySQLdb
    conn= MySQLdb.connect(
        host='192.168.137.3',
        port = 3306,
        user='monitor',
        passwd='1234567',
        db ='information_schema'
        )
    sql=(
        "SELECT ifnull(trx_id, 'null')," 
        "ifnull(trx_state,'null')," 
         "ifnull(trx_started,'null')," 
        "ifnull(trx_wait_started,'null')," 
        "ifnull(trx_weight,'null')," 
        "ifnull(trx_mysql_thread_id,'null')," 
        "ifnull(trx_query,'null')," 
        "ifnull(trx_operation_state,'null')," 
        "ifnull(TRX_TABLES_IN_USE,'null')," 
        "ifnull(trx_rows_locked,'null')," 
         "ifnull(trx_rows_modified,'null')," 
        "ifnull(trx_tables_locked,'null') FROM information_schema.innodb_trx"
    )
    print sql
    cur = conn.cursor()
    a = cur.execute(sql)
    info = cur.fetchall()
    print info
    
    C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/templates/a11.py
    SELECT ifnull(trx_id, 'null'),ifnull(trx_state,'null'),ifnull(trx_started,'null'),ifnull(trx_wait_started,'null'),ifnull(trx_weight,'null'),ifnull(trx_mysql_thread_id,'null'),ifnull(trx_query,'null'),ifnull(trx_operation_state,'null'),ifnull(TRX_TABLES_IN_USE,'null'),ifnull(trx_rows_locked,'null'),ifnull(trx_rows_modified,'null'),ifnull(trx_tables_locked,'null') FROM information_schema.innodb_trx
    (('1641456', 'RUNNING', '2017-12-13 23:07:32', 'null', '1', '13092', 'null', 'null', '0', '0', '0', '0'),)
    
    Process finished with exit code 0

  • 相关阅读:
    Centos7 ftp服务器搭建
    搭建单机版spark
    JAVA JDBC大数据量导入Mysql
    springboot使用自带连接池连接postgre
    linux centos6安装postgresql
    SpringBoot中配置不序列化返回值为null的属性
    sublime 3 安装格式化JSON插件
    HIve分组查询返回每组的一条记录
    FastJson乱序问题
    深入理解迪杰斯特拉算法
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349368.html
Copyright © 2020-2023  润新知