An alternative might be to use the Bulk Upload API, documented here.
The API allows you to upload an Excel spreadsheet of cases, where the column headers are the names of the case properties.
Python’s “tablib” library makes it easy to create this Excel spreadsheet on the fly. You can find some sample code here. And you can see a function for uploading that file just below it, here.
If Python is not your thing, I hope that the code is readable enough to implement in your language of choice.
Useful things to note about that code:
'search_field': 'external_id' tells CommCare to use the value in the “external_id” column to identify cases by. Considering the cases in MySQL come from CommCare, you may already have their case ID. If so, you can use a column called “case_id” instead. (If you use “external_id”, values must be unique. Case IDs will always be unique.)
- You’ll want to change
'comment': 'Imported from DHIS2 tracked entities' to something more meaningful for you, like “Imported from MySQL” maybe.
I hope that helps.