Skip to content

Instantly share code, notes, and snippets.

@ralph
Created September 20, 2012 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ralph/3756816 to your computer and use it in GitHub Desktop.
Save ralph/3756816 to your computer and use it in GitHub Desktop.
Import Geoplanet to MySQL
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;
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