Reportbuilder ... the Sequel (Thanks to Adam Jenkins)
SQL Report lets you turn a SQL query into a fully configurable Moodle report — no programming required. Write your query, click Publish, and the plugin creates a Report Builder report your colleagues can run, filter, chart, schedule, and export.
📖 Read the full user documentation →
⚠️ Reporting tools can expose sensitive data. Always test who can see a report before sharing it.
The full user documentation covers the edit form, writing SQL, placeholders, the SQL editor, AI generation, audiences, charts, scheduled emails, import/export, troubleshooting, and more.
- Write a
SELECTquery (or generate one with AI) and publish it as a Report Builder report. - Choose columns, filters, sorting, and charts through the standard Report Builder UI.
- Control who can open each report via audiences (course participants, roles, cohorts, all users).
- Schedule reports to be emailed on a recurring basis.
- Cross-database placeholders (
%%TIMESTAMP%%,%%NOW%%,%%COURSEID%%,%%CASE%%, …) keep queries portable across MySQL/MariaDB and PostgreSQL. - Import and export report views as portable JSON.
A published report can also be shown inline on a page, rendered through the same per-viewer access path as the report viewer — each person sees only the rows they are allowed to:
- filter_sqlreports — a text filter
that embeds a report in any Moodle text (a label, Page, Book chapter, forum post, or course
summary) with a
[[sqlreport:ID]]marker. - block_sqlreports — a block that pins one published report (as a table or chart) on a course page, the site front page, or the Dashboard.
See Showing a report on a page in the user documentation for setup.
- Moodle 4.5 – 5.2
- A database account with permission to create and drop database views.
Check the privilege from Site admin → Reports → SQL Report → Run database view privilege test.
- Copy the
sqlfolder into<moodleroot>/report/(so the plugin lives at<moodleroot>/report/sql/). - Go to Site admin → Notifications to complete the install.
- Run the privilege test above to confirm everything works.
| Role | What they can do |
|---|---|
| Manager (site-wide) | Write queries, publish/unpublish reports, see all reports |
| Authenticated user | Run published reports they have been given access to |
| Teacher (within a course) | Run reports published for their course |
Permissions are assigned at Site admin → Users → Permissions → Define roles. See the user documentation for the full capability model.
GNU GPL v3 or later — see COPYING.