You have a couple of distinct things you are doing here:
- Converting CSV to appropriate python (or JSON) structure for insertion in the datastore
- Inserting into the datastore
For the latter you can use either:
- The logic actions (direct)
- The DataStore API
The API just calls the logic actions (plus does auth) so these are pretty similar but the logic approach will likely be faster and could be more natural if you are already doing code. That said the API could be conceptually cleaner as you have nice boundaries to your different components in the form of defined web apis.
For the former (i.e. conversion of CSV to JSON) recommend you use the Data Converters library, especially the commas.py part which converts to exactly the format you need. There is a full web service being developed based on Data Converters but it is not yet fully operational.