Get Same "Current Term" as API Using SQL To Canvas Data

brett_sheeran
Community Novice

I'm currently attempting to port some in-house code from using the the API to Canvas Data SQL queries.

My problem if finding the the same "current term" as determined in API an using SQL query.

If I use this query,
select * from enrollment_term_dim;

I can see that for today, (2014-04-30) the current term ID is 32760000000000050.

However, when I run the following query to find a user's courses, I get 0 results.

select c.id, c.canvas_id, c.name, c.code, c.start_at, c.conclude_at, c.workflow_state from enrollment_dim e join course_dim c where e.user_id = 174440267134376236 and e.workflow_state = 'active' and e.course_id = c.id and c.enrollment_term_id = 32760000000000050;

Whereas, if I run the same query for the previous term of 32760000000000049 (which finished 2018-04-13) I see the same courses as returned thru the API request like this:

.../users/id_type:id/courses?access_token=XXX

All I want to do is be consistent with the API

Any suggestions?

Thanks.

Regards

Brett S

0 Likes