Skip to content

Commit

Permalink
KH-541: Ozone Analytics Queries to flatten Locations (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruhanga authored May 23, 2024
1 parent 1ae2109 commit 850a156
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 0 deletions.
1 change: 1 addition & 0 deletions analytics/dsl/export/queries/locations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
INSERT into locations SELECT t.* from analytics.analytics.locations t
37 changes: 37 additions & 0 deletions analytics/dsl/export/tables/locations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
CREATE TABLE locations (
location_id BIGINT,
name VARCHAR,
description VARCHAR,
address1 VARCHAR,
address2 VARCHAR,
city_village VARCHAR,
state_province VARCHAR,
postal_code VARCHAR,
country VARCHAR,
latitude VARCHAR,
longitude VARCHAR,
creator BIGINT,
date_created TIMESTAMP,
county_district VARCHAR,
address3 VARCHAR,
address4 VARCHAR,
address5 VARCHAR,
address6 VARCHAR,
retired BOOLEAN,
retired_by BIGINT,
date_retired TIMESTAMP,
retire_reason VARCHAR,
parent_location BIGINT,
uuid VARCHAR,
changed_by BIGINT,
date_changed TIMESTAMP,
address7 VARCHAR,
address8 VARCHAR,
address9 VARCHAR,
address10 VARCHAR,
address11 VARCHAR,
address12 VARCHAR,
address13 VARCHAR,
address14 VARCHAR,
address15 VARCHAR
)
38 changes: 38 additions & 0 deletions analytics/dsl/flattening/queries/locations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
SELECT
location_id,
name,
description,
address1,
address2,
city_village,
state_province,
postal_code,
country,
latitude,
longitude,
creator,
date_created,
county_district,
address3,
address4,
address5,
address6,
retired,
retired_by,
date_retired,
retire_reason,
parent_location,
uuid,
changed_by,
date_changed,
address7,
address8,
address9,
address10,
address11,
address12,
address13,
address14,
address15
FROM
location
41 changes: 41 additions & 0 deletions analytics/liquibase/analytics/changelogs/0001-init.xml
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,45 @@
<column name="void_reason" type="VARCHAR" />
</createTable>
</changeSet>
<changeSet author="ruhanga" id="1716275877531">
<createTable tableName="locations">
<column name="location_id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="locations_pkey" />
</column>
<column name="name" type="VARCHAR"/>
<column name="description" type="VARCHAR"/>
<column name="address1" type="VARCHAR"/>
<column name="address2" type="VARCHAR"/>
<column name="city_village" type="VARCHAR"/>
<column name="state_province" type="VARCHAR"/>
<column name="postal_code" type="VARCHAR"/>
<column name="country" type="VARCHAR"/>
<column name="latitude" type="VARCHAR"/>
<column name="longitude" type="VARCHAR"/>
<column name="creator" type="BIGINT"/>
<column name="date_created" type="TIMESTAMP"/>
<column name="county_district" type="VARCHAR"/>
<column name="address3" type="VARCHAR"/>
<column name="address4" type="VARCHAR"/>
<column name="address5" type="VARCHAR"/>
<column name="address6" type="VARCHAR"/>
<column name="retired" type="BOOLEAN"/>
<column name="retired_by" type="BIGINT"/>
<column name="date_retired" type="TIMESTAMP"/>
<column name="retire_reason" type="VARCHAR"/>
<column name="parent_location" type="BIGINT"/>
<column name="uuid" type="VARCHAR"/>
<column name="changed_by" type="BIGINT"/>
<column name="date_changed" type="TIMESTAMP"/>
<column name="address7" type="VARCHAR"/>
<column name="address8" type="VARCHAR"/>
<column name="address9" type="VARCHAR"/>
<column name="address10" type="VARCHAR"/>
<column name="address11" type="VARCHAR"/>
<column name="address12" type="VARCHAR"/>
<column name="address13" type="VARCHAR"/>
<column name="address14" type="VARCHAR"/>
<column name="address15" type="VARCHAR"/>
</createTable>
</changeSet>
</databaseChangeLog>

0 comments on commit 850a156

Please sign in to comment.