Ad-hoc database queries
Maintained by
Tim Hunt, Mahmoud Kassaei, Hieu Vu Van
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.
Comments
Comments are no longer open for new posts. Existing comments remain available to read.
(It is like this, becuase the plugin is based on Moodle's general Database library, and that is how that works.)
Moodle Version: 4.1.1 (2022112801)
Release: 01.16.2023
PHP: 7.4.33
MySQL: 5.7.33-0ubuntu0.16.04.1
but get the message "Cannot obtain task lock" Does anyone else get this when trying to run this on demand? The task seems to not have run since September 2022. It happens both on our production (Moodle 3.9) and our development server (Moodle 4.1) and with plugin versions 2021070700 and 2022031800.
Ability to share selected queries with teachers would be a great feature, but we don't have any immediate plans to develop it ourselves. If someone else can develop this in a good, we will would be delighted to get a pull request on github.
I created a report with a provided query. When i use this on demand it works fine. When I want to mail the results nothing happens.
I can see that the CRON task has run
Ad-hoc database queries: run scheduled reports task \report_customsql\task\run_reports Scheduled 21/07/22, 09:28 0.09 secs cron04 1626851 3 reads 0 writes Success
but the report did not
aa This query was last run on woensdag, 20 juli 2022, 16:18 . It took 0.005s to run. Available to Only administrators (moodle/site:config).
What do I do wrong
I'm working on a MoodleWorkplace 3.11.6 (build: 20220314)
But also LMS 3.11.8 (build: 20220711)
(I thought I need some webservice permission, but it was a report access problem)
My next problem, when I try to call the service:
{"error":"Sorry, but you do not currently have permissions to do that (Change site configuration).","errorcode":"nopermissions","stacktrace":null,"debuginfo":null,"reproductionlink":null}
Which permissions ("Webservice function") do I need?
I have a webservice test user with several webservice functions and some other REST calls was successful.
Can I find any documentation or examples about this feature?
WHERE course.shortname LIKE '%2022%'
(to work out the exact details, you will meed to know SQL, and which courses you want the report to include.)