Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
On this page
|
Available Macros
The following Confluence Macros are made available for use by this product:
- SQL Macro
- SQL-query Macro - performance optimized for read-only SQL statements
- SQL-file Macro - locked to just run administrator defined queries
Example Usage
No Format |
---|
{sql-query:dataSource=TestDS|output=wiki}
select * from test
{sql-query}
|
Example Chart
The query below will render Confluence site statistics (see right)
No Format |
---|
{chart:title=Confluence Content|type=pie|displayData=true|width=500|height=300
|dataOrientation=vertical|pieSectionLabel=%0% - %1%|legend=false|
tables=content|attachment=Confluence content.png}
{sql:dataSource=confluenceDS|id=content}
select contenttype as Type, count(distinct CONTENT.title) as "Count"
from CONTENT
group by contenttype
having count(distinct CONTENT.title) > 0
union
select contenttype as Type, count(*) as "Count"
from CONTENT
where contenttype='COMMENT'
group by contenttype
having count(*) > 0
union
select 'ATTACHMENTS' as Type, count(distinct title) as "Count"
from ATTACHMENTS
order by "Count" DESC
{sql}
{chart}
|
Chart Output
...
Click on one of the following to get step-by-step guides, examples, or recipes for using SQL for Confluence:
Child pages (Children Display)