Gatmando
Gatmando

Reputation: 2269

Is it possible to query Google Cloud Storage custom metadata?

We are planning a solution that will be storing images in a Google Cloud Storage bucket. Nothing complex - just a bucket with a number of images. Each image will have custom metadata associated which will contain a number of key-value pairs including a userId of the person creating the image.

What we would like to do is run a query against the bucket objects passing in a userId as a search param and get back a list of image objects that have the custom metadata key 'userId' set that that user's id.

Is such a thing possible in Cloud Storage, and if so what is the mechanism?

Upvotes: 2

Views: 855

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317958

Cloud Storage doesn't have a "query" engine behind it. You should instead duplicate the metadata (and the file path in Storage) to a database that's capable of the kinds of queries you want, then query the database directly instead. When you find objects of interest, then you can deal with them directly from Cloud Storage. This is the typical pattern.

Upvotes: 2

Related Questions