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!

eugenejay's avatar
23
eugenejay
asked 2022-04-12 03:09:37 -0500, updated 2022-04-12 03:33:24 -0500
edit flag offensive 0 remove flag close merge delete

Comments

My database is postgresql and the askbot is branch master.

eugenejay's avatar eugenejay (2022-04-12 03:10:37 -0500) edit

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 (2022-04-14 07:35:35 -0500) edit
add a comment 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')
    
Evgeny's avatar
13.2k
Evgeny
answered 2023-05-08 21:11:33 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments