I'm using Google Cloud Platform to host a web app. The app has a typical database structure, with a schema defined by Django migrations. For one of the models, Song, each record should be associated with an object stored in Cloud Storage which contains the audio of that song. Since this audio is created and stored immediately after the database record is created, what I've done historically is to simply title the object with the ID of the database record, so that each object would be stored as song/[ID]/audio.mp3

Is there a better approach to this? As long as each database record has a static ID, I can't see any critical issues with this one (and indeed, I've used it successfully in past projects of mine). But I have a hunch that many people would consider this a weak coupling and could open up the possibility for bugs.


In this case, for any Song you would have only one possible audio.mp3 recoding.

With various versions of the same song you will have to provide an additional field within the metadata.

In certain circumstances it may be valuable to prepare in advance some structure for various versions of the same record, building a path with defined version number, default to, say, 0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.