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): 678

Frankenstyle name: report_customsql
Reports

Comments

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

The data from reports that have been run are stored in the moodledata folder, in moodledata/admin_report_customsql. There should be a subfolder full of CSV files with the id of each report that runs on a schedule. Has someone deleted those folders?
Hi Tim, I've been running Ad-hoc database queries for 3 years now and all fine until today. I'm currently on version 2014061800. Last night, the cron log stated my regular queries ran per usual but when I look at the report in the plugin, I obtain the message "This query has not yet been run.". There have been no changes to the system/code and archives date back to 2013. No errors in any logs. Any ideas why they disappeared and do you have any info on how the archives are retrieved via the plugin? I'm aiming to restore from a backup. I can see they still exist in the data folder. Thanks, Andrew (Moodle 2.6.11)
Yes. That is the right way to do it. smile
Ok, I understand, thank you.
As I don't want the Non-Editing Teacher role on system context, I created a new role (based on no archetype) on system context with only the report/customsql:view permission and assigned that role to the user(s) who are permitted to run the ad-hoc database queries in any course where I added the HTML block and all seems to works fine now.
The explanation is in how the Moodle roles and permissions system works.
Users only have the teacher role within one particular course. These reports are outside of any course, in the systems context. Users do not have the teacher role in the system context, so the permissions on the teacher role are irrelevant.
I have the same issue.
- I created two reports for viewing by Non-Editing Teachers.
- I gave the Non-Editing Teachers the report/customsql:view role.
Result as others: No report entry (in Essential theme) to run the reports.
Then:
- I created a HTML block in a specific course
- I added the report links in this HTML block with /report/customsql/view.php?id=2
- I logged in and access the course with Non-Editing Teacher role
Result when clicking the link:
- Navigation jumps to Home
- Error message displayed: Sorry, but you do not currently have permissions to do that (View custom queries report)
For Tim Hunt.... Thank you for your suggestion. I don't know how to link the report page to the navigation... I supposed that enabling the students to see the report should make it visible somewhere when they log in. What I make is:
- defined a report as visibile to anyone (report/customsql:view)
- allowed "View custom query report" in Student role
- Student role is assigned to context Course and Activity module but not System, User, Category and Block
- got an overview from the "capability overview" menu item that shows "Allow" for "View custom query report" and "Student" (but it looks for System)
Thank you for any suggestion on how to solve it or where to look and check.
hello - this looks exactly what we need terms of reporting. it works fine in our moodle 3.0 installation. one thing, i tried a couple of the user contributed reports and they work - however, the reports that we specifically want, "user logins per week and activity for a specific course" does not work. i think this contributed SQL was written for pre 2.7 or legacy reporting.
but we have no idea on writing or amending our own SQL and therefore have no idea on what to do to create our own reports.
does anyone have any ideas or recommendations how we can quickly learn or obtain the reports we need.
I think the issue comes from how the report page is linked into the navigation. It means that in practice you cannot give permission to see the reports to people who cannot see the list of all reports. It should not be like that, but that is the area of code that needs to be fixed (the calls to admin_externalpage_setup).
I'm trying to make a query accessible to the students.
I defined the query as report/customsql:view and changed the student role to make this report/customsql:view permitted to the students.
If I report privilege for this report/customsql:view it looks that the student role is enabled to see it.
But users with the student role do not appear to be allowed to access to it.
Would you please suggest where to check to make it work?
Thanks
The latest version works fine in Moodle 3.0.
I have added a query and its working fine in admin. Now i want to give that access to that report to all Student. I checked the permission and gave permission all ad-hoc allow for students . But still i am not able to see that report links.
Can anyone help me regarding this ?
Hello,
I am looking at the available report options but don't see one that counts currently enrolled users within a time period e.g. How many users were enrolled between 1 month or some other time period (1 week, 30 days). I am just looking for the number of enrolled users across the whole site that are enrolled between dates and not course specific. Could someone point me to which one would carry that out please? Or perhaps help with the query that I would need to use or change?
Thanks
Al
Hi Tim and Mahmoud,
Just added one more pull request. This one puts the list of reports in a table to make it easier to read the list of reports, especially when combined with the expandable/collapsible list feature I added last week.
Let me know if you have any questions or concerns.
Best regards,
Michael
Hi Tim and Mahmoud,
I just added a few pull requests.
Any idea when a Moodle 3.0 compatible version might become available?
Best regards,
Michael Milette