Versions Compared

Key

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

...

The SQL Query macro displays values from SQL statements or scripts (or both) on Confluence pages. Statements can range from data manipulation language (DML), data definition language (DDL), data control language (DCL), and transaction control language (TCL) statements. Some databases support read-only SQL statements. The SQL Query macro uses this support, if applicable, with such databases. 

Note

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 (Image Added) 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:

...