Skip to end of banner
Go to start of banner

How to use SQL to find pages

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Description

This may be appropriate if you have specific requirements and conditions. Otherwise we recommend using the techniques from How to find Confluence pages and then do something

  1. You are familiar with SQL
  2. Confluence Server and you have access to the Confluence database
  3. You want to do exact content search and have a large number of pages which would prevent you from using the Search Content approach because it would take too long. 

Steps

  1. Construct a SQL query that selects the pages you are interested in. Test against your database.
  2. select '--id ' || contentid from content where content.title like '%title 1%' and contenttype = 'PAGE' and content.spaceid = (select spaceid from spaces where spacekey = 'zconfluencecli2')
    
  3. Figure out the runFromSql parameters for accessing your database.

  4. Put it all together in a single command: 

    confluence -a runFromSql --common "-a modifyPage --content \"before existing content\" " --database confluence-3.5.13 --driver postgresql --sql "select '--id ' || contentid from content where content.title like '%title 1%' and contenttype = 'PAGE' and content.spaceid = (select spaceid from spaces where spacekey = 'zconfluencecli2')"
    
  • No labels