-
Notifications
You must be signed in to change notification settings - Fork 7
/
faa.load
79 lines (79 loc) · 1.55 KB
/
faa.load
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
71
72
73
74
75
76
77
78
79
LOAD CSV
FROM 'MASTER.TXT'
HAVING FIELDS (
n_number,
serial_number,
mfr_mdl_code,
eng_mfr_mdl,
year_mfr,
type_registrant,
name,
street,
street2,
city,
state,
zip_code,
region,
county,
country,
last_action_date,
cert_issue_date,
certification,
type_aircraft,
type_engine,
status_code,
mode_s_code,
fract_owner,
air_worth_date,
other_names_1,
other_names_2,
other_names_3,
other_names_4,
other_names_5,
expiration_date,
unique_id,
kit_mfr,
kit_model,
mode_s_code_hex,
ignored)
INTO postgresql:///orbital?faa_registration
TARGET COLUMNS (
n_number,
serial_number,
mfr_mdl_code,
eng_mfr_mdl,
year_mfr,
type_registrant,
name,
street,
street2,
city,
state,
zip_code,
region,
county,
country,
last_action_date,
cert_issue_date,
certification,
type_aircraft,
type_engine,
status_code,
mode_s_code,
fract_owner,
air_worth_date,
other_names_1,
other_names_2,
other_names_3,
other_names_4,
other_names_5,
expiration_date,
unique_id,
kit_mfr,
kit_model,
mode_s_code_hex)
WITH truncate,
skip header = 1,
fields terminated by ','
AFTER LOAD DO $$ UPDATE faa_registration SET n_number = CONCAT('N', n_number); $$
;