Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article explains how to get the SQL macro usage in the confluence pages/spaces using the app SQL for Confluence.

Instructions

Follow the below steps:

...

  1. Login as Confluence Admin and go to General Configuration.
  2. Click on the app SQL for Confluence (Pro Edition) under Bob Swift Configuration.
  3. Click on View and modify data source profiles tab.
      Image Removed

...

This article explains how to get a list of Confluence pages and the respective spaces where the SQL for Confluence app is used.

Instructions

  1. Log into Confluence, navigate to the required page where you want to display the usage information.
  2. Edit the page, and, enter {sql or search for the SQL for Confluence macro.

    Info

    You must know the Data source profile name that can be used to run queries given in the following instructions.

    If you do not know which profile name can be used, contact your Confluence Administrator before proceeding.


  3. Edit the macro and select the Data source profile.
    Image Added
  4. In your SQL profile table, there is a number associated with the table mentioned in the query. Replace XXXX with that number and run the query to get the list of database profiles created in your Confluence instance.

    Code Block
    themeMidnight
    select profile_name from AO_xxxxx_SQLPROFILES;
    Image Removed


  5. Click on Save setting to get the list of Database profiles from the above query Save settings.
    Image RemovedImage Added

    Click
  6. on the Save button on the confluence Save your Confluence page.
    Replace the Image Added
  7. Replace Mysql_confluence with your database profile name in place of Mysql_confluence in the below query to get the list of space details. Execute the below query for each of the database profile names. and run the query. The query retrieves a list of all spaces, for each database profile name (taken from the query results above), that uses the macro.

    Code Block
    themeMidnight
    SELECT c.title, s.spacekey FROM CONTENT c JOIN BODYCONTENT bc ON c.contentid = bc.contentid JOIN SPACES s ON c.spaceid = s.spaceid WHERE c.prevver IS NULL AND c.contenttype IN ('PAGE', 'BLOGPOST') AND bc.body LIKE '%ac:name="dataSource">Mysql_confluence%';


  8. Click on Save settings to save the SQL query.

    Click on the Save button
  9. on the confluence Save your Confluence page.
  10. This SQL query will Run the following query to list all the pages containing SQL macro in your confluence space.   the space (taken from the query results above) that uses the macro:

    Code Block
    themeMidnight
    Select CONTENT.CONTENTID, CONTENT.Title, CONTENT.SpaceID, CREATOR, LASTMODDATE from CONTENT, BODYCONTENT WHERE PREVVER IS NULL AND (CONTENT.CONTENTTYPE = 'PAGE' OR CONTENT.CONTENTTYPE = 'BLOGPOST') AND CONTENT.CONTENTID = BODYCONTENT.CONTENTID AND CONTENT.CONTENT_STATUS = 'current' AND (BODYCONTENT.BODY like '%<ac:structured-macro ac:name="sql"%');
    


  11. Click Save settings.
    Image Modified
  12. Click Save to publish Publish the page to view the entire list of spaces and pages where the macro is used.
Info

To configure Refer to this link to know more about database source profiles in Confluence, refer to this link.