Ad-hoc database queries

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.
Price option: Free

Supports Moodle 1.9-5.1 See all versions
Latest release: 2 weeks ago
Installations: 4762
Downloads (last 90 days): 674

Frankenstyle name: report_customsql
Reports

Comments

Comments are no longer open for new posts. Existing comments remain available to read.

A couple of questions about changing run time of scheduled reports
For reference, all my ad-hoc scheduled tasks run at 10 minutes after every hour and all reports have the "Scheduled, Daily" option.
Question 1 - if a report is set to "Scheduled, daily" and it fails to run for some reason at, say, 7:10am, how would I "reset" it so that scheduled tasks can run it again later the same day?
Question 2 - what is the latest time I can edit a report, and change the time, so that it is still run? For example, if I edit a scheduled report that was scheduled to run at 7:10am and save it at 7:08am, will it be run at 7:10am?
Just wondering for debugging purposes. Thanks again for a great plugin that, quite frankly, my group could not do without.
Richard
Why have I an error near 'Add_Discussion_Forum_Essentiels('%DCP98', '%Forum des Essentiels%', 123) LIMIT 0' at line 1 Add_Discussion_Forum_Essentiels('%DCP98', '%Forum des Essentiels%', 123) LIMIT 0, 2 [array egg]. My line contains only Add_Discussion_Forum_Essentiels('%DCP98', '%Forum des Essentiels%', 123). Why adding LIMIT to my line ???
Glad to hear that it was found.
I'm currently looking deeper into the code, and I am looking at some enhancements to meet my needs (maybe something you would be interested in). One is to have a flag to determine if emails are sent out or not if the result set is empty (helps with sending alerts).
The other is to add an hourly option to the schedule to assist with hourly scheduled reports. This for me is useful when writing queries that will be used as alerts to specific users (mostly for teachers). I'm still working out the logic for this one.
Ah! We just foudn this bug ourselves last week, and our fix, which is the same as yours, is just going through testing.
I have started to work with this plugin, which I found to be incredibly useful (thank you to the developers).
However, I have had to make some small modifications on my version to get it working the way I need and I want to share my feedback.
In the locallib.php file, I found that the subject line for the emails that get sent is not currently pulling the query name (display name) which it is coded to do. I modified these lines in mine by changing "report_customsql_plain_text_report_name($report->displayname)" in the code to "report_customsql_plain_text_report_name($report)" since the "report_customsql_plain_text_report_name()" function looks at the $report object as a whole and then returns the query name.
Hope this is helpful,
~Adam Gogo
Thank you very much for the help smile
It is a path on the local server. Here is how the setting is used in the code https://github.com/moodleou/moodle-report_customsql/blob/master/locallib.php#L670. (That could be a file path that is a mount of a network disc, or similar.)
Hello, thanks for your work.
I've been looking for information about the "Export csv report to path / directory" functionnality but couldn't find any.
What kind of path is expected? A local path from the server root? Where can I export my file?
The contextual help (in Portuguese) didn't seem to be filled. Maybe I can help with that once I understand the feature.
Thanks
Unfortunately, I don't have the skills to help you out with that, Tim. sad
I've submitted a bug report. I hope I did it right. I think I've only ever done one before.
https://tracker.moodle.org/browse/CONTRIB-7238
I don't think that was an intentional change. A but report would be good. A patch would be even better, if you can do one smile
Hi, Tim. I noticed that the last update stripped away the report name from the email report. They all show up as "Query" now. Was that intentional, or should I do a bug report?
I have finally done a 3.2+ compatible version.
Hi Tim and Mahmoud,
Will there be a version of Ad-hoc Database Queries compatible with Moodle 3.2 and beyond? If so, when do you think we can expect to see an updated 3.4 compatible version?
Michael
Fixed it. After a LOT of debugging (and reading lots of documentation), I updated my.cnf with group_concat_max_len=8M and max_allowed_packet=16M. So far, so good - I'm finally getting emails with the large report in my Inbox.
Keeping my fingers crossed. Thanks for your help...
Richard
Some more information - after doing some more debugging, I noticed the following in the SQL debug output:
eventdata as \stdClass is deprecated. Please use core\message\message instead.
line 67 of /lib/messagelib.php: call to debugging()
line 641 of /report/customsql/locallib.php: call to message_send()
line 582 of /report/customsql/locallib.php: call to report_customsql_send_email_notification()
line 131 of /report/customsql/locallib.php: call to report_customsql_email_report()
line 78 of /report/customsql/classes/task/run_reports.php: call to report_customsql_generate_csv()
line 104 of /lib/cronlib.php: call to report_customsql\task\run_reports->execute()
line 292 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
line 91 of /admin/tool/task/schedule_task.php: call to cron_run_single_task()
What caught my eye is the report_customsql_send_email_notification call.
Richard