Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Handle possibility of duplicate courses being inserted to course table (#174) #175

Merged

Conversation

ssciolla
Copy link
Contributor

@ssciolla ssciolla commented May 21, 2020

Similar to PR #146, this PR adds duplicate dropping to the creation of course records to avoid possible errors when inserting into the database. The modifications include the use of pd.DataFrame.drop_duplicates with the subset parameter to limit duplicate consideration to the PK (canvas_id) and the keep parameter to ensure the second record found is kept. This change is responding to incidents in the production and test processes where a different course in each process seems to have been duplicated. The PR aims to resolve issue #174.

@ssciolla
Copy link
Contributor Author

ssciolla commented May 21, 2020

If you want to test this, you can do something like this (from a testing branch): https://github.com/ssciolla/course-inventory/blob/f448a2f77feed0b353c8d570302f5b089ca37dfc/course_inventory/inventory.py#L178-L188

@ssciolla ssciolla linked an issue May 21, 2020 that may be closed by this pull request
@ssciolla ssciolla changed the title Handle possibility of duplicate courses (#174) Handle possibility of duplicate courses in course table (#174) May 21, 2020
course_inventory/inventory.py Show resolved Hide resolved
@ssciolla ssciolla changed the title Handle possibility of duplicate courses in course table (#174) Handle possibility of duplicate courses being inserted to course table (#174) May 22, 2020
@ssciolla ssciolla merged commit 700b986 into tl-its-umich-edu:master May 22, 2020
@ssciolla ssciolla linked an issue May 22, 2020 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 bug Something isn't working Canvas 🥞 database
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Canvas API may return duplicate courses
3 participants