Skip to content

Instantly share code, notes, and snippets.

@bardware
Last active July 16, 2017 12:52
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 bardware/0466c32c559911dcb2e88a416b5733d3 to your computer and use it in GitHub Desktop.
Save bardware/0466c32c559911dcb2e88a416b5733d3 to your computer and use it in GitHub Desktop.
Import tweets.csv into MySQL DB
CREATE TABLE `tweets` (
`tweet_id` bigint(11) NOT NULL,
`in_reply_to_status_id` bigint(11) NOT NULL,
`in_reply_to_user_id` bigint(11) NOT NULL,
`timestamp` varchar(100) COLLATE utf8mb4_german2_ci NOT NULL,
`source` varchar(4000) COLLATE utf8mb4_german2_ci NOT NULL,
`text` varchar(4000) COLLATE utf8mb4_german2_ci DEFAULT NULL,
`retweeted_status_id` bigint(11) DEFAULT NULL,
`retweeted_status_user_id` bigint(11) DEFAULT NULL,
`retweeted_status_timestamp` bigint(11) DEFAULT NULL,
`expanded_urls` varchar(4000) COLLATE utf8mb4_german2_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_german2_ci
LOAD DATA LOCAL INFILE 'tweets.csv' INTO TABLE tweets FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '' LINES TERMINATED BY '\n';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment