Sarge
Sarge

Reputation: 408

Uploading blob data using python in GAE

I have my simple application deployed and working. Despite using forms I want to run a script on my pc to upload data into GAE blobstore. Bulkloader does it well when I upload data to datastore, but could not find any way to upload the same way for blobstore.

I know that Bulkloader does not have the ability to upload blob data to blobstore of GAE. But I wonder if is there a way to upload blob into blobstore via python scripts?

I have used and succesed doing it from form applications, but now I am getting data from some other db and want to upload the contents to datastore and blobstore. Trying to upload blob into datastore totally messed up.

So, is it possible to upload given attribute values of a table to blobstore via some python scripts?

Upvotes: 1

Views: 372

Answers (1)

James
James

Reputation: 641

You need to:

  1. Create a Google Cloud project for the application. (via Application Settings for your app)
  2. Upload your blobs to Google Cloud Storage.
  3. Access them using the Blobstore API.

Details here: https://developers.google.com/appengine/docs/python/blobstore/#Python_Using_the_Blobstore_API_with_Google_Cloud_Storage

I was considering the same a few weeks ago, but I only had ~90 MB of static files. I ended up including them as static data in my app. The appcfg upload script is smart enough to detect when the same files have previously been uploaded and clones them as needed for subsequent uploads. That might be something you want to consider, depending on your situation.

Upvotes: 1

Related Questions