Revision 56332
Added by Michele Artini almost 5 years ago
import_grid_ac.sql | ||
---|---|---|
81 | 81 |
COPY grid_institutes (grid_id,name,wikipedia_url,email_address,established) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/institutes.csv' CSV HEADER; |
82 | 82 |
COPY grid_geonames (geonames_city_id,city,nuts_level1_code,nuts_level1_name,nuts_level2_code,nuts_level2_name,nuts_level3_code,nuts_level3_name,geonames_admin1_code,geonames_admin1_name,geonames_admin1_ascii_name,geonames_admin2_code,geonames_admin2_name,geonames_admin2_ascii_name) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/geonames.csv' CSV HEADER; |
83 | 83 |
COPY grid_addresses (grid_id,line_1,line_2,line_3,lat,lng,postcode,is_primary,city,state,state_code,country,country_code,geonames_city_id) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/addresses.csv' CSV HEADER; |
84 |
COPY grid_external_ids (grid_id,external_id_type,external_id) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/external_ids.csv' CSV HEADER; |
|
85 |
COPY grid_labels (grid_id,iso639,label) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/labels.csv' CSV HEADER; |
|
84 |
COPY grid_external_ids (grid_id,external_id_type,external_id) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/external_ids.csv' CSV HEADER;
|
|
85 |
COPY grid_labels (grid_id,iso639,label) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/labels.csv' CSV HEADER;
|
|
86 | 86 |
COPY grid_relationships (grid_id,relationship_type,related_grid_id) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/relationships.csv' CSV HEADER; |
87 |
COPY grid_types (grid_id,type) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/types.csv' CSV HEADER; |
|
88 |
COPY grid_links (grid_id,link) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/links.csv' CSV HEADER; |
|
89 |
COPY grid_acronyms (grid_id,acronym) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/acronyms.csv' CSV HEADER;
|
|
90 |
COPY grid_aliases (grid_id,alias) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/aliases.csv' CSV HEADER;
|
|
87 |
COPY grid_types (grid_id,type) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/types.csv' CSV HEADER;
|
|
88 |
COPY grid_links (grid_id,link) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/links.csv' CSV HEADER;
|
|
89 |
COPY grid_acronyms (grid_id,acronym) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/acronyms.csv' CSV HEADER;
|
|
90 |
COPY grid_aliases (grid_id,alias) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/data/grid-2019-05-06/full_tables/aliases.csv' CSV HEADER;
|
|
91 | 91 |
|
92 | 92 |
|
93 | 93 |
INSERT INTO organizations(id, name, lat, lng, city, country, source) (SELECT 'openaire____::'||md5(o.grid_id), o.name, a.lat, a.lng, a.city, a.country_code, 'grid.ac' FROM grid_institutes o LEFT OUTER JOIN grid_addresses a ON (o.grid_id=a.grid_id)) ON CONFLICT DO NOTHING; |
94 | 94 |
INSERT INTO other_ids (id, otherid, type) (SELECT 'openaire____::'||md5(grid_id), grid_id, 'grid.ac' FROM grid_institutes ) ON CONFLICT DO NOTHING; |
95 | 95 |
INSERT INTO other_ids (id, otherid, type) (SELECT 'openaire____::'||md5(grid_id), external_id, external_id_type FROM grid_external_ids ) ON CONFLICT DO NOTHING; |
96 |
INSERT INTO labels (id, lang, label) (SELECT 'openaire____::'||md5(grid_id), iso639, label FROM grid_labels ) ON CONFLICT DO NOTHING; |
|
96 |
INSERT INTO other_names (id, lang, name) (SELECT 'openaire____::'||md5(grid_id), 'en', name FROM grid_institutes ) ON CONFLICT DO NOTHING; |
|
97 |
INSERT INTO other_names (id, lang, name) (SELECT 'openaire____::'||md5(grid_id), iso639, label FROM grid_labels ) ON CONFLICT DO NOTHING; |
|
98 |
INSERT INTO other_names (id, lang, name) (SELECT 'openaire____::'||md5(grid_id), '', alias FROM grid_aliases ) ON CONFLICT DO NOTHING; |
|
99 |
INSERT INTO acronyms (id, acronym) (SELECT 'openaire____::'||md5(grid_id), acronym FROM grid_acronyms ) ON CONFLICT DO NOTHING; |
|
97 | 100 |
INSERT INTO relationships(id1, reltype, id2) (SELECT 'openaire____::'||md5(grid_id), relationship_type, 'openaire____::'||md5(related_grid_id) FROM grid_relationships) ON CONFLICT DO NOTHING; |
98 | 101 |
INSERT INTO types (id, type) (SELECT 'openaire____::'||md5(grid_id), type FROM grid_types ) ON CONFLICT DO NOTHING; |
99 | 102 |
INSERT INTO urls (id, url) (SELECT 'openaire____::'||md5(grid_id), link FROM grid_links ) ON CONFLICT DO NOTHING; |
100 |
INSERT INTO acronyms (id, acronym) (SELECT 'openaire____::'||md5(grid_id), acronym FROM grid_acronyms ) ON CONFLICT DO NOTHING; |
|
101 |
INSERT INTO aliases (id, alias) (SELECT 'openaire____::'||md5(grid_id), alias FROM grid_aliases ) ON CONFLICT DO NOTHING; |
|
102 | 103 |
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
Also available in: Unified diff