Created
September 20, 2012 16:08
-
-
Save ralph/3756816 to your computer and use it in GitHub Desktop.
Import Geoplanet to MySQL
This file contains hidden or 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 TABLE `places` ( | |
`woeid` varchar(15) NOT NULL, | |
`iso` varchar(6) NOT NULL, | |
`name` text NOT NULL, | |
`language` varchar(6) NOT NULL, | |
`type` varchar(15) NOT NULL, | |
`parent` varchar(15) NOT NULL, | |
PRIMARY KEY (`woeid`) | |
) ENGINE=MyISAM DEFAULT CHARSET=utf8; | |
CREATE TABLE `aliases` ( | |
`woeid` varchar(15) NOT NULL, | |
`name` text NOT NULL, | |
`name-type` varchar(6) NOT NULL, | |
`language` varchar(6) DEFAULT NULL, | |
KEY `woeid` (`woeid`) | |
) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
This file contains hidden or 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
ln -s geoplanet_places_*.tsv places.tsv | |
mysqlimport -uroot -p geoplanet --ignore-lines=1 --fields-optionally-enclosed-by=\" -L places.tsv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment