'Store details of Blobkey for images stored in google cloud storage

I am trying to migrate an application from the google app engine standard environment first generation(python 2.7 runtimes) to second-generation ( python 3 runtimes).

The application serves the user-specific images stored in google cloud storage(previously blob storage). I have completed most of the migration as mentioned in the migration guide provided by Google.

I am facing the following challenges:

  1. I am not able to find any specific way of creating blob key for blobs stored in google cloud storage. In the previous generation, I could use create_gs_key but that functionality seems removed.
  2. Old application has stored image detail in the form of ndb.BlobKeyProperty() how I can migrate these to cloud storage and retain the information. For the previous generation, I could use the GoogleAppEngineCloudStorageClient library.

Current stack:

  • google app engine : python 3 runtime, flask HTML, jquery, javascript

Old stack:

  • google app engine : python 2.7 runtime, webapp2, HTML, jquery, javascript

Disclaimer:

  • Google does provide the option to use app engine APIs in python 3 runtimes by enabling appengine apis in app.yaml but it seems this functionality might be removed at any time.
  • I do not want to keep the application permanently on python 2.7 using docker.
  • Apart from images API, I am not using any other legacy google app engine service.

I might have missed something so feel free to correct me.

EDIT 1:

  1. As mentioned, I have an old application that has blob_key indicating the blob key for stored images, if in the current version I have to use the file name directly I will have to either migrate the images stored in the form of blob key to google cloud storage, make changes to the model( I am trying to avoid this unless and until I don't have any other option)

  2. If I understand correctly, google.appengine.api.blobstore.blobstore is deprecated and using blob store methods is discouraged(Correct me if I am wrong).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source