c.execute("SELECT kpi_id FROM kpi WHERE device_id is ? AND kpi_sample_type is ? AND endpoint_id is ? AND service_id is ?",(device_id,kpi_sample_type,endpoint_id,service_id))
c.execute("SELECT kpi_id FROM kpi WHERE device_id is ? AND kpi_sample_type is ? AND endpoint_id is ? AND service_id is ?",(device_id,kpi_sample_type,endpoint_id,service_id,connection_id))
data=c.fetchone()
ifdataisNone:
c.execute("INSERT INTO kpi (kpi_description,kpi_sample_type,device_id,endpoint_id,service_id) VALUES (?,?,?,?,?)",(kpi_description,kpi_sample_type,device_id,endpoint_id,service_id))
c.execute("INSERT INTO kpi (kpi_description,kpi_sample_type,device_id,endpoint_id,service_id) VALUES (?,?,?,?,?)",(kpi_description,kpi_sample_type,device_id,endpoint_id,service_id,connection_id))
self.client.commit()
kpi_id=c.lastrowid
LOGGER.debug(f"KPI {kpi_id} succesfully inserted in the ManagementDB")