Ad-hoc database queries

Reports ::: report_customsql
Maintained by Tim at Lone Pine Koala SanctuaryTim Hunt, at the OU (Perry building)Mahmoud Kassaei
This report plugin allows Administrators to set up arbitrary database queries to act as ad-hoc reports. Reports can be of two types, either run on demand, or scheduled to run automatically. Other users with the right capability can go in and see a list of queries that they have access to. Results can be viewed on-screen or downloaded as CSV.

Ad-hoc database queries 3.6 for Moodle 3.3+

Moodle 3.3, 3.4, 3.5, 3.6
Released: Friday, November 23, 2018, 2:58 AM

Changes in 3.6

  • New feature for columns that are links. If the SQL query returns two columns name and name_link_url (for any value of name) then the that will be shown as a single column of links, where the visible link text comes from the name column, and the URL comes from the name_link_url column.
  • The exact case of the column titles is extracted from the query. So, if your query is SELECT 'x' AS My_HTML, previously the table would display the column heading as 'my html'. Now it will show 'My HTML'.
  • A summary of the number of rows output under the table.
  • Moodle 3.3 compatibility re-established thanks to Paul Holden.
  • Behat tests fixed for Moodle 3.6.

Version information

Version build number
Version release name
3.6 for Moodle 3.3+
Stable version
MD5 Sum
Supported software
Moodle 3.3, Moodle 3.4, Moodle 3.5, Moodle 3.6

Version control information

Version control system (VCS)
VCS repository URL
VCS tag

Default installation instructions for plugins of the type Reports

  1. Make sure you have all the required versions.
  2. Download and unpack the module.
  3. Place the folder (eg "myreport") in the "report" subdirectory.
  4. Visit to finish the installation