Export all data of all posts

Is it possible to export the data of all posts?


I don’t know all of the ways but the most practical way would be if you have Discourse admin rights then

In the upper right click Hamburger menu.
Click Admin.
Scroll down until you see Backups.
Click on Backups which will take you a new page listing the backups available.
Click download and follow the instructions which uses an e-mail to verify you are really who you claim to be.
IIRC this results in a *.tar.gz file
From the *.tar.gz file the *.sql file can be extracted and used to populate a new empty database in a PostgreSQL database.

Note that posts is a table and has two columns that hold data about a post, raw which is the text as entered and cooked which is closer to the HTML you see but I don’t exactly how to cook the raw as I am not a chef. :grinning:



Can you elaborate on what you are trying to do? Do you want a backup of the entire database? Do you want the content of some specific topics/posts? What’s your end goal?


Hi @HAWK, I need all the content from the posts.

Using the backup options outlined above will give you a machine readable file with all posts content (and more).


@Falco Is there a way to get a human readable file with all the post’s content?

I’m trying to avoid going post by post and copy/pasting to google docs :slight_smile:

1 Like

I tried this but when I try to run the .sql file in on my PostgreSQL database, I get a syntax error:

ERROR:  syntax error at or near "1"
LINE 5066: 1 33a64b9c942fe3f0b264467590ac83a2207b557db26e86ec8d3ebcf605...
SQL state: 42601
Character: 126056

Any advice?