FIXED
query_with_parameters = """select ID, IP_src, IP_dst, sum(bytes) as Total_Bytes, count(*) as total_packets, ( sum(bytes) / count(*) )\
as Average, date_format(date, "%%H") as Hour , date_format(date, "%%d %%m %%Y") as date_n from Packets\
where date BETWEEN %s and %s group by IP_src, IP_dst, Hour,\
date_n order by IP_src, IP_dst, Hour, date_n;"""
By simply adding % in front of the one for the mysql db got it fixed ;)
Hope it may be helpful for others :D