First time here? Check out the FAQ!
1

what format is needed when importing old data?
 

I want to import my old data. The data is in a excel, which contains questions, answers and related authors.

Are these any APIs I can use to import data? And btw what format is needed?

Wish for your answer, thank you very much!

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
eugenejay's avatar
23
eugenejay
asked 2 years ago, updated 2 years ago

Comments

My database is postgresql and the askbot is branch master.

eugenejay's avatar eugenejay (2 years ago)

I use django-import-export to import my old data. After i import thread, post and post revision, it works. But there is no thread_tag import API, so i can't search by tags. Hope for your answer. @Evgeny

eugenejay's avatar eugenejay (2 years ago)
see more comments

1 Answer

0

I would write a Python code iterating over your data which:

  • creates users using Django user creation api.
  • posts questions, answers and comments as below

    from askbot.models import User
    u = User.objects.get(email='user@example.com')
    q = u.post_question(title='my title', body_text='my text in markdown format', tags='tag1 tag2 tag3')
    u.post_answer(question=q, body_text='my answer body text')
    u.post_comment(parent_post=q, body_text='my comment body text')
    

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 1 year ago
link

Comments

see more comments