Skip to content
Snippets Groups Projects
Commit f8295d6d authored by Lucas Fernandes de Oliveira's avatar Lucas Fernandes de Oliveira
Browse files

Merge branch 'issue/42' into 'master'

Issue #42: Remove references to databases

See merge request !33
parents e034df60 a1922c35
Branches
No related tags found
1 merge request!33Issue #42: Remove references to databases
Pipeline #
...@@ -15,3 +15,4 @@ ...@@ -15,3 +15,4 @@
/typings /typings
/build /build
/dist /dist
/database/views
SELECT
id AS "dim:city"
, name AS "dim:city_name"
, region AS "dim:region"
, state AS "dim:state"
, id AS "met:count:city"
FROM
city
;
SELECT
contact_date AS "dim:contactDate"
, id_point AS "dim:point"
, macaddr AS "dim:macAddr"
, down_bytes AS "met:avg:download"
, up_bytes AS "met:avg:upload"
, '1'::INTEGER AS "met:count:countact"
, contact_date AS "met:max:contact"
, down_bytes AS "met:max:upload"
, up_bytes AS "met:max:download"
, down_bytes AS "met:sum:download"
, up_bytes AS "met:sum:upload"
FROM
fact_net_usage
;
SELECT
is_current AS "dim:currentInventory"
, load_date AS "dim:inventoryDate"
, id_point AS "dim:point"
FROM
dim_inventory
WHERE
is_current = '1'
;
SELECT
d.new_hd_size AS "dim:disk"
, d.new_date AS "dim:inventoryDate"
, d.machine AS "dim:macAddr"
, d.new_memory_size AS "dim:memory"
, d.old_hd_size AS "dim:oldDisk"
, d.old_date AS "dim:oldInventoryDate"
, d.old_memory_size AS"dim:oldMemory"
, d.os_distro AS "dim:os"
, d.id_point AS "dim:point"
, d.processor AS "dim:processor"
, '1'::INTEGER AS "met:count:machines"
, d.hd_alert AS "met:modifiedDisk"
, d.memory_alert AS "met:modifiedMemory"
FROM
(
SELECT
pt.id AS id_point
, c.id AS id_city
, c.region AS region
, c.state AS state
, initcap(c.name) AS city
, initcap(a.establishment) AS telecenter
, i1.macaddr AS machine
, i1.load_date AS old_date
, i2.load_date AS new_date
, i1.os_distro AS os_distro
, i1.processor AS processor
, simplify_memory(i1.memory) AS old_memory_size
, simplify_memory(i2.memory) AS new_memory_size
, simplify_hd(i1.disk1_size) AS old_hd_size
, simplify_hd(i2.disk1_size) AS new_hd_size
, alert_check_memory(i1.memory, i2.memory) AS memory_alert
, alert_check_hd(i1, i2) AS hd_alert
FROM
dim_inventory i1
INNER JOIN dim_inventory i2
ON i1.id_point = i2.id_point
AND i1.macaddr = i2.macaddr
AND i1.is_first = '1'
AND i2.is_current = '1'
INNER JOIN point pt ON pt.id = i1.id_point
INNER JOIN address a ON a.id_point = pt.id
INNER JOIN city c ON pt.id_city = c.id
WHERE
pt.is_telecenter = '1'
) AS d
WHERE
d.memory_alert = 'true'
OR d.hd_alert = 'true'
;
SELECT
p.is_active AS "dim:active"
, p.id_city AS "dim:city"
, p.is_digital_city AS "dim:digitalCity"
, p.is_gesac AS "dim:gesac"
, p.id AS"dim:point"
, current_date AS "dim:pointDate"
, a.establishment AS "dim:pointName"
, CASE
WHEN (p.is_digital_city = TRUE) THEN 'DC'
WHEN (p.is_telecenter = TRUE AND p.is_gesac = FALSE) THEN 'TLBR'
WHEN (p.is_telecenter = TRUE AND p.is_gesac = TRUE) THEN 'TLBR/GESAC'
ELSE 'GESAC'
END AS"dim:project"
, p.is_telecenter AS "dim:telecenter"
, '1'::INTEGER AS "met:count:point"
, h.hired_download AS "met:avg:hiredDownload"
, h.hired_upload AS "met:avg:hiredUpload"
FROM
point p
INNER JOIN address a ON p.id = a.id_point
LEFT OUTER JOIN (
SELECT
c.id_point
, ct.download_kbps AS hired_download
, ct.upload_kbps as hired_upload
FROM
convention c
INNER JOIN connection_type ct ON ct.id = c.id_connection_type
) h ON p.id = h.id_point
;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment