def f_get_parm(p_dbinfo): conn = MySQLdb.connect(host=p_dbinfo[0], user=p_dbinfo[1], passwd=p_dbinfo[2],db=p_dbinfo[3]) cursor = conn.cursor() cursor.execute("select lower(variable_name),variable_value from performance_schema.global_variables where upper(variable_name) in ('"+"','".join(list(SYS_PARM_FILTER))+"') order by variable_name") records = cursor.fetchall() cursor.close() conn.close() return records
if f_find_in_list(p_option,'PROFILING'): cursor.execute("set profiling=1") cursor.execute("select ifnull(max(query_id),0) from INFORMATION_SCHEMA.PROFILING") records = cursor.fetchall() query_id=records[0][0] +2 #skip next sql
if f_find_in_list(p_option,'STATUS'): #cursor.execute("select concat(upper(left(variable_name,1)),substring(lower(variable_name),2,(length(variable_name)-1))) var_name,variable_value var_value from performance_schema.session_status where variable_name in('"+"','".join(tuple(SES_STATUS_ITEM))+"') order by 1") cursor.execute("select concat(upper(left(variable_name,1)),substring(lower(variable_name),2,(length(variable_name)-1))) var_name,variable_value var_value from performance_schema.session_status order by 1") records = cursor.fetchall() results['BEFORE_STATUS']=dict(records)