From f96e5f81084cd349b72eb46221956e4b3fcbb457 Mon Sep 17 00:00:00 2001 From: Robert Latta <robert.latta@geant.org> Date: Mon, 7 Jan 2019 14:02:15 +0000 Subject: [PATCH] Cast SQL return values to lower case for easy comparison --- inventory_provider/opsdb.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/inventory_provider/opsdb.py b/inventory_provider/opsdb.py index c400b432..80485ced 100644 --- a/inventory_provider/opsdb.py +++ b/inventory_provider/opsdb.py @@ -25,10 +25,10 @@ equipment_location_query = """SELECT circuit_hierarchy_query = """SELECT pc.name AS parent_circuit, pc.absid AS parent_circuit_id, - pc.status AS parent_circuit_status, + LOWER(pc.status) AS parent_circuit_status, cc.name AS child_circuit, cc.absid AS child_circuit_id, - cc.status AS child_circuit_status, + LOWER(cc.status) AS child_circuit_status, cg.segment_group AS segment_group FROM circuit_glue cg INNER JOIN circuit pc ON pc.absid = cg.PTR_circuit @@ -39,9 +39,9 @@ retrieve_services_query = """SELECT * FROM (SELECT c.absid AS id, c.name, - c.status, - c.circuit_type, - c.service_type, + LOWER(c.status) AS status, + LOWER(c.circuit_type) AS circuit_type, + LOWER(c.service_type) AS service_type, events.short_descr AS project, e.name AS equipment, cc.port_a AS port, @@ -69,9 +69,9 @@ retrieve_services_query = """SELECT * SELECT c.absid AS id, c.name, - c.status, - c.circuit_type, - c.service_type, + LOWER(c.status) AS status, + LOWER(c.circuit_type) AS circuit_type, + LOWER(c.service_type) AS service_type, events.short_descr AS project, e.name AS equipment, cc.port_b AS port, @@ -99,9 +99,9 @@ retrieve_services_query = """SELECT * SELECT c.absid AS id, c.name, - c.status, - c.circuit_type, - c.service_type, + LOWER(c.status) AS status, + LOWER(c.circuit_type) AS circuit_type, + LOWER(c.service_type) AS service_type, events.short_descr AS project, e.name AS equipment, cc.port_a_OUT AS port, @@ -130,9 +130,9 @@ retrieve_services_query = """SELECT * SELECT c.absid AS id, c.name, - c.status, - c.circuit_type, - c.service_type, + LOWER(c.status) AS status, + LOWER(c.circuit_type) AS circuit_type, + LOWER(c.service_type) AS service_type, events.short_descr AS project, e.name AS equipment, cc.port_b_OUT AS port, -- GitLab