CD2: Query Repository / Sharing

DanL
Community Participant

I thought I'd start a thread for posting Canvas Data 2 queries we've found useful, and not being a DBA myself, for review/feedback if you have found better ways of getting the same data.

Users Query, including pseudonym/communication channel lookup (login info, email address/es, etc.):

SELECT u.id,
       u.created_at,
       u.updated_at,
       u.workflow_state,
       u.sortable_name,
       u.name,
       u.time_zone,
       u.avatar_image_url,
       u.avatar_image_source,
       u.short_name,
       u.last_logged_out,
       u.pronouns,
       u.merged_into_user_id,
       p.deleted_at,
       p.integration_id,
       p.created_at  pcreated_at,
       p.updated_at  pupdated_at,
       p.sis_batch_id,
       p.unique_id   NetID,
       p.login_count,
       p.failed_login_count,
       p.last_request_at,
       p.last_login_at,
       p.current_login_at,
       p.last_login_ip,
       p.current_login_ip,
       p.sis_user_id EmplID,
       c.path        email
FROM   canvas.users u,
       canvas.pseudonyms p,
       canvas.communication_channels c
WHERE  u.id = p.user_id
       AND u.id = c.user_id
       AND c.path_type = 'email'
       AND c.position = 1
ORDER  BY sortable_name ASC 

0 Likes