-
Notifications
You must be signed in to change notification settings - Fork 0
/
csv_imports
212 lines (177 loc) · 4.07 KB
/
csv_imports
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
## Sample CSV import scripts
# Import for MPD records
create table psrc_parcel_working_mpds.tehaleh_20180426
(
proposal_id integer not null
,start_year integer not null
,status_id integer not null
,is_redevelopment integer not null
,parcel_id integer not null
,units_proposed integer not null
,template_id integer not null
,primary key (proposal_id)
);
## If your imported text fields include little paragraph signs and / or line breaks try this:
## LINES TERMINATED BY '\r\n'
## Tab delimited use '\t'
## Good Stack Overflow discussion at https://stackoverflow.com/questions/13579810/how-to-import-data-from-text-file-to-mysql-database
LOAD DATA LOCAL INFILE 'J:/Projects/UrbanSim/NEW_DIRECTORY/Inputs/base_year_cache/mpds/Reapply_Tehaleh_April2018.csv'
INTO TABLE psrc_parcel_working_mpds.tehaleh_20180426
FIELDS TERMINATED BY ','
#ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(
proposal_id
,start_year
,status_id
,is_redevelopment
,parcel_id
,units_proposed
,template_id
);
create table run_104_20180406_2014.seattle_select_mu_zoning_parcels
(
fid integer not null
,join_count integer not null
,target_fid integer not null
,parcel_id integer not null
,jurisdiction text
,flu_key text
,definition text
,max_du_acre float not null
,max_far float not null
,primary key (parcel_id)
);
## If your imported text fields include little paragraph signs and / or line breaks try this:
## LINES TERMINATED BY '\r\n'
LOAD DATA LOCAL INFILE 'T:/2018April/rebeccah/SeaMUZone_prcl.csv'
INTO TABLE run_104_20180406_2014.seattle_select_mu_zoning_parcels
FIELDS TERMINATED BY ','
#ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(
fid
,join_count
,target_fid
,parcel_id
,jurisdiction
,flu_key
,definition
,max_du_acre
,max_far
);
;
create table run_104_20180406_2014.snohomish_uu_parcels_flu
(
parcel_id integer not null
,zone_flu text
,jurisdiction_flu text
,key_flu text
,definition_flu text
,min_du_flu float not null
,max_du_flu float not null
,min_far_flu float not null
,max_far_flu float not null
,primary key (parcel_id)
);
## If your imported text fields include little paragraph signs and / or line breaks try this:
## LINES TERMINATED BY '\r\n'
LOAD DATA LOCAL INFILE 'C:/Users/msimonson/gis_files/snohomish_uu_parcels_flu.csv'
INTO TABLE run_104_20180406_2014.snohomish_uu_parcels_flu
FIELDS TERMINATED BY ','
#ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(
parcel_id
,zone_flu
,jurisdiction_flu
,key_flu
,definition_flu
,min_du_flu
,max_du_flu
,min_far_flu
,max_far_flu
);
create table run_104_20180406_2014.beccah_snoco_dense_prcl
(
psrc_id integer not null
,jurisdiction text
,zone text
,key_flu text
,parcel_sqft integer not null
,plan_type_id integer not null
,far float not null
,units_per_acre float not null
,primary key (psrc_id)
);
## If your imported text fields include little paragraph signs and / or line breaks try this:
## LINES TERMINATED BY '\r\n'
LOAD DATA LOCAL INFILE 'C:/Users/msimonson/gis_files/SnoCo_DensePrcl.csv'
INTO TABLE run_104_20180406_2014.beccah_snoco_dense_prcl
FIELDS TERMINATED BY ','
#ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(
psrc_id
,jurisdiction
,zone
,key_flu
,parcel_sqft
,plan_type_id
,far
,units_per_acre
);
create table run_104_20180406_2014.prcl15_4k
(
fid integer not null
,objectid integer not null
,taz integer not null
,park integer not null
,acres float not null
,objectid_2 integer not null
,pin text
,area float not null
,county integer not null
,major text
,minor text
,length float not null
,psrc_id integer not null
,length_2 float not null
,area_2 float not null
,orig_fid integer not null
,point_x float not null
,point_y float not null
,primary key (psrc_id)
);
## If your imported text fields include little paragraph signs and / or line breaks try this:
## LINES TERMINATED BY '\r\n'
LOAD DATA LOCAL INFILE 'C:/Users/msimonson/gis_files/psrc15_4k_text.txt'
INTO TABLE run_104_20180406_2014.prcl15_4k
FIELDS TERMINATED BY ','
#ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(
fid
,objectid
,taz
,park
,acres
,objectid_2
,pin
,area
,county
,major
,minor
,length
,psrc_id
,length_2
,area_2
,orig_fid
,point_x
,point_y
);