Tuesday, November 10, 2020

Python - Script to measure block performance (Time = Tempo)

 #Script de Tempo Begin

from datetime import datetime
from dateutil.relativedelta import relativedelta
def diff(t_at_b):
    t_diff = relativedelta(t_b, t_a)  # later/end time comes first!
    return '{h}{m}{s}s'.format(h=t_diff.hours, m=t_diff.minutes, s=t_diff.seconds)
t_a = datetime.now()

 #Processo a medir

df = pd.read_sql_query(""" SELECT * from ErrorLog """ , cnxn)


#Script de Tempo End
t_b = datetime.now()
diff(t_a,t_b)

print("Time End: ",diff(t_a,t_b))

No comments:

Post a Comment

Power Query - funcao limpa replace texto numero

//fnc_limpa_texto (TextValue as nullable text) => let     SafeText = if TextValue = null then "" else TextValue,     DigitsOnly...