最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

google cloud platform - How to query into project labels (not BQ labels) - Stack Overflow

programmeradmin8浏览0评论

We are using labels on GCP projects, and I am trying to figure out how to "unwrap" them/ query against them. I am finding almost no success as any search with BigQuery and labels returns results related to label in BQ itself.

I have tried several selects, but can't crack it.

SELECT
  name,
  #JSON_QUERY(TO_JSON(prj.resource.data.labels),"$"),
  # ARRAY_TO_STRING(prj.resource.data.labels, ','),
  #TO_JSON_STRING(prj.resource.data.labels),
  prj.resource.data.labels,
FROM
  cloudresourcemanager_googleapis_com_Project AS prj
#WHERE
#  prj.resource.data.labels.key = 'vanity-name' AND
#  prj.resource.data.labels.value = 'bob'
;

The above query shows the following data structure:

Can anyone give guidance on how to:

  1. Query into the labels to say "does key 'x' exist", and/or "does key 'x' exist and is it's value 'y'"?

Thanks in advance for any help....

发布评论

评论列表(0)

  1. 暂无评论