I have about 4000 records that I need to upload to Datastore.
They are currently in CSV format. I'd appreciate if someone would point me to or explain how to upload data in bulk to GAE.
I have about 4000 records that I need to upload to Datastore.
They are currently in CSV format. I'd appreciate if someone would point me to or explain how to upload data in bulk to GAE.
By using remote API and operations on multiple entities. I will show an example on NDB using python, where our Test.csv contains the following values separated with semicolon:
First we need to import modules:
Then we need to create remote api stub:
For more information on using remote api have a look at this answer.
Then comes the main code, which basically does the following things:
Main code:
The put_multi operation also takes care of making sure to batch appropriate number of entities in a single HTTP POST request.
Have a look at this documentation for more information:
You can use the bulkloader.py tool:
I don't have the perfect solution, but I suggest you have a go with the App Engine Console. App Engine Console is a free plugin that lets you run an interactive Python interpreter in your production environment. It's helpful for one-off data manipulation (such as initial data imports) for several reasons:
I suggest something like the following:
csv
module to chop up your data until you have a list of useful data structures (most likely a list of lists or something like that)for
loop, iterating through each each data structure in the list:You should find that after one iteration through #5, then you can either copy and paste, or else write simple functions to speed up your import task. Also, with fetching and processing your data in steps 5.1 and 5.2, you can take your time until you are sure that you have it perfect.
(Note, App Engine Console currently works best with Firefox.)
the later version of app engine sdk, one can upload using the appcfg.py
see appcfg.py