How To Export Confluence Questions Content to CSV Through the Database

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: サーバーと Data Center のみ。この記事は、サーバーおよび Data Center プラットフォームのアトラシアン製品にのみ適用されます。

This guide is for informational purposes and is not eligible for support as part of the Atlassian Support Offerings.  If you have any questions about the information on this page, please reach out to our Atlassian Community for help.

目的

This guide will help you exporting the whole content generated in the Confluence Questions plugin to a CSV file by running a query against the application's database.

ソリューション

This process requires the use of direct database manipulation and is not part of Confluence's intended functionality. As such, this process is not covered under the Atlassian Support Offerings and the information on this page is provided as-is. It should be thoroughly tested in a development or staging environment before implementing any changes in your production instance.

  • This query was written to be used in PostgreSQL. If you're using another DBMS, it might be necessary to adjust the query to use the specific functions of your DBMS.

    COPY
      (SELECT 
      		  c.contentid AS "ID",
      		  c.parentccid AS "Parent_id",
      		  (CASE
                   WHEN c.pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:question' THEN 'QUESTION'
                   WHEN c.pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:answer' THEN 'ANSWER'
                   WHEN c.pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:comment' THEN 'COMMENT'
               END) AS "Type",
              c.title AS "Title",
              bc.body AS "Content"
       FROM content c
       INNER JOIN bodycontent bc ON c.contentid = bc.contentid
       WHERE c.pluginkey IN ('com.atlassian.confluence.plugins.confluence-questions:question',
                             'com.atlassian.confluence.plugins.confluence-questions:answer',
                             'com.atlassian.confluence.plugins.confluence-questions:comment')
      ) TO '/tmp/questions.csv' WITH CSV HEADER DELIMITER ',';
    tip/resting Created with Sketch.

    Note that the path at the end of the query is set to /tmp/questions.csv. This will save the file in your /tmp/ directory in a Unix environment, with the file named as questions.csv. If you're using Windows or want to change the path, please update this before running the query.



最終更新日: 2021 年 10 月 19 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.