Created
October 31, 2014 18:18
-
-
Save krilnon/71b999cb79d032023f3d to your computer and use it in GitHub Desktop.
Example SQL->CSV export queries for vBulletin->Discourse import script
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
use kf; | |
select | |
post.postid, | |
post.threadid, | |
post.userid, | |
replace(replace(pagetext, '\n', '\\n'), '\r', '\\r'), | |
post.dateline, | |
post.visible, | |
post.parentid, | |
thread.firstpostid | |
from | |
post | |
inner join `thread` on post.threadid = thread.threadid | |
where | |
postid = thread.firstpostid | |
into outfile "D:\\\SQLOutput\\firstpost.csv" | |
character set utf8 | |
fields | |
terminated by ',' | |
escaped by '"' | |
enclosed by '"' | |
lines terminated by '\n' | |
; |
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
use kf; | |
select | |
forumid, | |
title, | |
displayorder, | |
replace(replace(description, '\n', ''), '\r', '') | |
from | |
forum | |
into outfile "D:\\\SQLOutput\\forum.csv" # this is used by import_categories, primarily | |
fields | |
terminated by ',' | |
escaped by '"' | |
enclosed by '"' | |
lines terminated by '\n' | |
; |
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
use kf; | |
select | |
usergroupid, | |
forumid, | |
forumpermissions | |
from | |
forumpermission | |
into outfile "D:\\\SQLOutput\\forumpermission.csv" # this is used by import_categories, primarily | |
fields | |
terminated by ',' | |
escaped by '"' | |
enclosed by '"' | |
lines terminated by '\n' | |
; |
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
use kf3; | |
select | |
postid, | |
threadid, | |
userid, | |
replace(replace(pagetext, '\n', '\\n'), '\r', '\\r'), | |
dateline, | |
visible, | |
parentid | |
from | |
post | |
where postid > 2662917 #2323691 #1800186 #1280223 #558363 | |
order by postid asc | |
limit 500000 | |
into outfile "D:\\\SQLOutput\\post_kf3.csv" # this is used by import_categories, primarily | |
character set utf8 | |
fields | |
terminated by ',' | |
escaped by '"' | |
enclosed by '"' | |
lines terminated by '\n' | |
; |
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
use kf3; | |
select | |
threadid, | |
"open", | |
firstpostid, | |
postuserid, | |
replace(replace(title, '\n', '\\n'), '\r', '\\r'), | |
forumid, | |
dateline, | |
visible, | |
views, | |
sticky | |
from | |
thread | |
where threadid > 381060 | |
into outfile "D:\\\SQLOutput\\thread_kf3.csv" # this is used by import_categories, primarily | |
character set utf8 | |
fields | |
terminated by ',' | |
escaped by '"' | |
enclosed by '"' | |
lines terminated by '\n' | |
; |
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
use kf3; | |
select | |
userid, | |
username, | |
email, | |
homepage, | |
replace(replace(usertitle, '\n', '\\n'), '\r', '\\r'), | |
usergroupid | |
from | |
user | |
where | |
userid > 218292 | |
#limit | |
# 100 | |
into outfile "D:\\\SQLOutput\\user_kf3.csv" | |
character set utf8 | |
fields | |
terminated by ',' | |
escaped by '"' | |
enclosed by '"' | |
lines terminated by '\n' | |
; |
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
use kf; | |
select | |
usergroupid, | |
title | |
from | |
usergroup | |
into outfile "D:\\\SQLOutput\\usergroup.csv" | |
fields | |
terminated by ',' | |
escaped by '"' | |
enclosed by '"' | |
lines terminated by '\n' | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment