External database with multiple tables

External database with multiple tables

by Kimber Warden -
Number of replies: 3

I have an external MS SQL registration database that I would like to use to create new users in Moodle and enroll them in their proper courses. I have read-only access.

I've tried using the external database enrollment plug in, but it appears that it can only pull data from a single table. Is that really true, or am I missing something? My registration database uses multiple tables and I need Moodle to import data from several of them. There must be a way to do this. Can I use the external enrolment plug-in, or do I need to go another route?

Not everyone in my external database should be imported to Moodle. For example, I want only students who have already paid their tuition and who are enrolled only in certain courses. Should I try to write a script that creates a single table populated only with students who meet a certain criteria, and use the new table to enroll users in Moodle? How would I go about doing that? I have read-only access to the external database, so would I need to create a new MySQL database to create the single table?

I'm a front end web developer with only a basic understanding of database connections and queries, but I'm willing to learn. If someone wouldn't mind giving me some guidance or walking me through the process, I'd be SO grateful!

Kimber

Average of ratings: -
In reply to Kimber Warden

Re: External database with multiple tables

by Chad Bergeron -

Kimber,

 

Other institutions have been able to create a 'view' on the database server to present the desired information as if it were one table.  I can't say if this will work or not in your case, but it might be an option to explore.  It should be possible to tailor the view to include only the information you want, but it does require someone with access to the databased to create the view for you.  You could do it through setting up your own MySQL database and populating a table based on constructed queries of the MSSQL system, but it is usually better to draw from the source directly where possible.  And if you do set something up on your own, expect to take on responsibility for maintaining it as well!

In reply to Chad Bergeron

Re: External database with multiple tables

by Kimber Warden -

Thanks for the suggestion. Our external database is ancient and barely maintained. There is no one to create a new view directly within it, so I'm stuck with trying to make it interface with Moodle via read-only access.

In reply to Kimber Warden

Re: External database with multiple tables

by Kimber Warden -

Update: Apparently I need to first create the users from the external database via the external database authentication plug-in. But I'm still using the same external database and have the same multi-table issues.