Skip to end of banner
Go to start of banner

How to use sql macro in a confluence user macro

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 15 Next »

This article explains how we can use SQL macro of SQL for Confluence app in a user macro section in Confluence. In this article, we considered inserting a simple SQL statement in the user macro

Instructions

  1. We can perform this action in two methods.
  2. Make sure that database connection is successful using the SQL for Confluence app.
    1. Log into your Confluence instance as an administrator and navigate to (Cog wheel) > Manage apps.
    2. From the left sidebar, select the SQL app > View and modify data source profiles and ensure that connection to the database is successful.

 Method 1:
  1. Insert SQL macro

  2. Enter SQL statement as required. In this example, a query to retrieve data from the persons table is used.

  3. Take the storage of the page:

  4. Navigate to Settings>General Configuration>User Macros and click Create a User Macro to create a new user macro.

  5. Fill in the required parameters and Categories as per the requirement.
  6. Insert the storage format in the Template and save.
  7. Now use the user macro in the confluence page.

Output:

 Method 2:
  1. Navigate to  Settings>General Configuration>User Macros and click Create a User Macro to create a new user macro.
  2. Fill in the required parameters and Categories as per the requirement.
  3. In the Template section fill the SQL query including the output format and datasource details and save the macro.

  4. Now use the user macro in the confluence page.

Output:

  • No labels