Last active
August 29, 2015 14:18
-
-
Save mrpunkin/7582190563863a84a904 to your computer and use it in GitHub Desktop.
Trying to update woeid on geoplanet_adjacencies with matching replacement_woeid from a changes.tsv file in MySQL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TEMPORARY TABLE geoplanet_changes ( | |
woeid BIGINT(20) NOT NULL PRIMARY KEY, | |
replacement_woeid BIGINT(20) NOT NULL, | |
data_version VARCHAR | |
); | |
LOAD DATA INFILE 'infile.tsv' INTO TABLE geoplanet_changes | |
FIELDS TERMINATED BY '\\t' OPTIONALLY ENCLOSED BY '\"' | |
(woeid, replacement_woeid, data_version); | |
SHOW COLUMNS FROM geoplanet_adjacencies; | |
UPDATE geoplanet_adjacencies, geoplanet_changes | |
SET geoplanet_adjacencies.woeid = geoplanet_changes.replacement_woeid | |
WHERE geoplanet_adjacencies.woeid = geoplanet_changes.woeid; | |
DROP TEMPORARY TABLE geoplanet_changes; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment