This page provides all the relevant information required to customize and use the app in an efficient and optimal manner.
The SQL Query macro displays values from SQL statements or scripts (or both) on Confluence pages. Some databases support read-only SQL statements. The SQL Query macro uses this support, if applicable, with such databases.
Read-only support means that the database can optimize for read-only statements. For some databases (PostgreSQL, for instance) the read-only condition is enforced while in others, it is a suggestion for improving performance.
Macro editor components
The macro editor has a new look and feel compared to the server version and aims to provide as much information at a glance for better usability. The main components of the editor are:
- Data source panel: Specify the data source of the relevant database and view any messages generated due to errors or after successful query execution here. There are two tabs in this panel as follows:
- Data source tab: This parameters on this tab are mostly mandatory that connect to your database and run the given query/script. Select a Data source profile, and then, either enter the relevant SQL statement(s) in the SQL statement section, or enable the Select SQL as an attachment option to specify the SQL script available on either the same or different space/page.
- Message tab: This tab displays the information about successful query/script execution or any error messages. The text of this tab changes colour to red if any errors were encountered, or turns green if the query execution was successful.
- After providing the data source, click Run to generate a table with the required data generated through the specified SQL statement or script. Click the cog icon () to view the Settings panel for other parameters to further define SQL query/script execution and format the generated table.
- Settings panel: Specify other parameters here to further define how the macro must handle the incoming data. The parameters available here are defined in the Parameters section below.
- Preview panel: See the data retrieved from the database and apply styles to the generated table here.
Parameters
The following parameters are available in the macro editor:
Macro editor tab | Macro editor label | Default value | Description | Macro parameter |
---|---|---|---|---|
Main panel | Data source profile | |||
Select SQL as an attachment | ||||
SQL statement | ||||
Settings > Runtime | Transaction isolation level | |||
Maximum number of rows to retrieve and display | ||||
Maximum number of seconds for query to run | ||||
Settings > Rendering | Table ID | |||
Display data filter | ||||
Insert auto number column | ||||
Enable pagination | ||||
Number of rows to be displayed on one page | ||||
Show error if there are no rows | ||||
Text to display when there are no rows | ||||
Show SQL |
Helpful resources
- Administrator guide to know more about app configuration
- Tutorials to understand app usage