Versions Compared

Key

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

Summary

Atlassian Cloud (formerly OnDemand) restricts the ability to install most add-ons. So how can you still implement concepts like How to use Confluence for Business Intelligence and Reporting? Or perhaps you are not allowed to install add-ons on your own corporate Confluence installation and you would still like to publish SQL or other external data (like excel data). Now there is a solution for both of these use cases. We will discuss this in terms of Cloud, but it applies equally to other restricted environments. While not as dynamic as using the add-ons directly, it only takes a few more steps to implement and skills and knowledge gained can also be applied in the other context. 

This is how the /wiki/spaces/info/pages/86083526 page is produced. Bamboo automation publishes the page once a day.

Tip
titleSQL for Cloud

Please vote for

Jira Legacy
serverJIRA (bobswift.atlassian.net)
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId729d679a-302c-339f-958b-015e107badcd
keySQL-243
.

Summary

Some of the elements here are optional depending on what you want to do and how automated you want to be. We will outline the most automatic and rich example.

You will need:

...

...

Create a publish page using the run, CLI and SQL-query macros. The key is that the SQL-query produces wiki markup because of output=unrenderedWiki (this is what gets published to Cloud)

No Format
titleWiki markup for publish page
{run:titleRun=Publish
|autoRun=true
|requestPrefix
|replace=profile:confluence:Profile:select::confluence-local::confluence-cloud}

{cli:profile=$profile|macros=true}

-a storePage --title "Project Summary" --space info --file - --minor --comment "Updated from database"

@DATA:
\{\{toc:type=flat|separator=pipe|minLevel=3|maxLevel=3}
h3. Confluence Add-ons
{sql-query:id=CONF|datasource=myDS|output=unrenderedWiki|columnTypes=S,S,S,S,S,S,S,S,C}
select ...
{sql-query}

{cli}

{run}

...

How to automate page rendering in Confluence 

Tip
titleHow to let some macros go unrendered to the published page

When macros=true is used in the CLI macro, all embedded macros are rendered. This is how the SQL data is generated. However, you may want some macros to not be rendered and remain in the markup so they get rendered on the target page. In this example, it is the toc macro. Simply escape the open bracket so the renderer does not render it and double up the opening bracket so the CLI macro will remove the extra after it is rendered.

Tip
titleReduce spam
  1. --minor is used on the storePage action to signal a minor update to avoid notifications being sent out - unfortunately at least some versions of Confluence do not respect this API setting (sad).
  2. Put specific and unique ids on the SQL macro (example: id=CONF). This prevents generating ids that are different each time the page is updated. If there are no other changes with the data for the update, the page will not be marked as changed and so no notifications will go out.

...

Include Page
SUPPORT:How to publish SQL queries on Atlassian Cloud
SUPPORT:How to publish SQL queries on Atlassian Cloud