You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: flowdb/testdata/bin/migrate_synth_data.py
+16-9Lines changed: 16 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -173,15 +173,22 @@ def do_exec(args):
173
173
174
174
INSERT INTO geography.geoms (short_name, long_name, geo_kind_id, spatial_resolution, geom)
175
175
SELECT admin0pcod as short_name, admin0name as long_name, 1 as geo_kind_id, 0 as spatial_resolution, geom
176
-
FROM geography.admin0;
177
-
178
-
INSERT INTO geography.geoms (short_name, long_name, geo_kind_id, spatial_resolution, geom)
179
-
SELECT district_c as short_name, district_n as long_name, 1 as geo_kind_id, 2 as spatial_resolution, geom
180
-
FROM public.gambia_admin2;
181
-
182
-
/* Populate the geobridge */
183
-
184
-
INSERT INTO geography.geo_bridge (location_id, gid, valid_from, valid_to, linkage_method_id)
176
+
FROM geography.admin0;"""
177
+
)
178
+
withengine.begin() astrans:
179
+
try:
180
+
trans.execute(
181
+
"""
182
+
INSERT INTO geography.geoms (short_name, long_name, geo_kind_id, spatial_resolution, geom)
183
+
SELECT district_c as short_name, district_n as long_name, 1 as geo_kind_id, 2 as spatial_resolution, geom
184
+
FROM public.gambia_admin2;"""
185
+
)
186
+
except:
187
+
pass# No gambia table
188
+
withengine.begin() astrans:
189
+
# Populate the geobridge
190
+
trans.execute(
191
+
"""INSERT INTO geography.geo_bridge (location_id, gid, valid_from, valid_to, linkage_method_id)
185
192
SELECT locations.location_id, geoms.gid, '-Infinity'::date as valid_from, 'Infinity'::date as valid_to, 1 as linkage_method_id from interactions.locations LEFT JOIN geography.geoms ON ST_Intersects(position, geom);
0 commit comments