-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathref_location_ddl.sql
70 lines (64 loc) · 1.88 KB
/
ref_location_ddl.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
DROP TABLE IF EXISTS ref_location;
CREATE TABLE ref_location
(
location_hash text,
location text,
enrichment_enabled boolean,
enrichment_status text,
formatted_address text,
latitude numeric(11,6),
longitude numeric(11,6),
load_dttm timestamp,
last_update_dttm timestamp,
google_place_id text,
google_partial_match boolean,
google_result_count integer,
google_result_type jsonb,
long_street_number text,
long_route text,
long_political text,
long_locality text,
long_postal_code text,
long_postal_code_suffix text,
long_postal_town text,
long_premise text,
long_country text,
long_admin_area_level_1 text,
long_admin_area_level_2 text,
long_admin_area_level_3 text,
long_admin_area_level_4 text,
long_admin_area_level_5 text,
long_establishment text,
short_street_number text,
short_route text,
short_political text,
short_locality text,
short_postal_code text,
short_postal_code_suffix text,
short_postal_town text,
short_premise text,
short_country text,
short_admin_area_level_1 text,
short_admin_area_level_2 text,
short_admin_area_level_3 text,
short_admin_area_level_4 text,
short_admin_area_level_5 text,
short_establishment text,
location_type jsonb,
enrichment_api_response jsonb,
CONSTRAINT pk_location_hash PRIMARY KEY (location_hash)
);
COMMENT ON TABLE ref_location
IS 'Fixed dimension with records treated as a cache of location queries to lookup from external geocode API.';
CREATE INDEX idx_enrichment_enabled
ON ref_location USING btree
(enrichment_enabled);
CREATE INDEX idx_enrichment_status
ON ref_location USING btree
(enrichment_status);
CREATE INDEX idx_location
ON ref_location USING btree
(location);
CREATE INDEX idx_location_hash
ON ref_location USING hash
(location_hash);