简体   繁体   English

使用Java客户端库获取按BigQuery中的标签过滤的表格列表

[英]Get a list of tables filtered by labels in BigQuery using Java client library

I'm using BigQuery's Java client library. 我正在使用BigQuery的Java客户端库。 May I ask if there is a way to specify labels when getting the list of BigQuery tables, so that the tables I get are already filtered by the labels I specified? 请问在获取BigQuery表列表时是否有一种方法可以指定标签,以便我获取的表已经被我指定的标签过滤了? The following example can't specify labels. 以下示例无法指定标签。

link 链接

As of today, as explained in the documentation for working with BigQuery lab , this option is not possible: 截至今天,如使用BigQuery实验室的文档中所述,此选项尚不可用:

Currently, you cannot list tables or views based on a filter specification. 当前,您不能基于过滤器规范列出表或视图。

In any case, the BigQuery team is already aware that this is an interesting feature for some use cases, given that there is a public Feature Request in which this option is requested. 无论哪种情况,BigQuery团队都已经意识到,对于某些用例来说,这是一个有趣的功能,因为有一个公共功能请求 ,其中要求使用此选项。 Feel free to star it in order to receive updates, and also add a comment of your own in order to explain your use case and highlight the usability of this option. 随时给它加注星标,以接收更新,并添加您自己的评论以解释您的用例并突出此选项的可用性。

As an alternative (which may not work for you), you would still be able to list all tables in a dataset and then filter by label on the client side, although in that case the client would be retrieving all the tables, obviously. 作为替代方法(可能不适合您),您仍然可以列出数据集中的所有表 ,然后在客户端按标签进行过滤,尽管显然,在这种情况下,客户端将检索所有表。


UPDATE: 更新:

Also, I have been able to find this other public Feature Request in which the INFORMATION_SCHEMA feature is announced, also with the possibility to request access to the Alpha release of this functionality. 另外,我还可以找到该其他公共功能请求 ,其中宣布了INFORMATION_SCHEMA功能,并且还可以请求访问此功能的Alpha版本。

Your project needs to be whitelisted in order to be able to use it. 您的项目需要列入白名单才能使用。 However, once you get the access (or the public is launched into public beta / GA), you should be able to list tables using a query like: 但是,一旦获得访问权限(或将公众发布到公共beta / GA中),您应该能够使用类似以下的查询来列出表:

CREATE TABLE
  [DATASET].[TABLE]
OPTIONS (labels = [('key1', 'value1'), ('key2', 'value2')])
AS SELECT 1 AS x, 'foo' AS y;

SELECT
  table_name
FROM
  [DATASET].INFORMATION_SCHEMA.TABLE_OPTIONS
WHERE
  option_name = 'labels'
  AND option_value LIKE '%key2%'

Please note that this feature is still in its Alpha release and therefore it is subject to changes in the future. 请注意,此功能仍在其Alpha版本中 ,因此将来可能会更改。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用POST请求和Java客户端库加载到BigQuery的任何示例? - Any examples of loading to BigQuery using a POST request and Java client library? bigquery.tables()。list()由JAVA返回null - bigquery.tables().list() returns null by JAVA 如何在使用客户端库 (java) 在 google BigQuery 中加载 csv 数据时跳过标题行 - How to skip header row while loading csv data in google BigQuery using client library (java) java.lang.IllegalStateException: getTransportChannel() 在数据流中使用 bigquery 客户端库时在 needsExecutor() 为真时调用 - java.lang.IllegalStateException: getTransportChannel() called when needsExecutor() is true while using bigquery client library in dataflow 如何使用Java获取客户端证书列表? - How to get list of client certificates using java? BigQuery-如何在Java客户端库中设置读取超时 - BigQuery - How to set read timeout in the Java client library Google AutoMl Tables:如何使用 JAVA 客户端库在数据集中设置目标列 - Google AutoMl Tables: How to set target column in the dataset using JAVA client library 有没有一种方法来获取属性文件中的某些已过滤键的列表在Java中? - is there a way to get a list of certain filtered keys inside property file in java? 如何使用Java中的Jenkins客户端获取Jenkins的作业详细信息列表 - How to get Jenkins list of job details using Jenkins client in Java 使用Java GET从客户端接收链接列表 - Receive Linked List from client using Java GET
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM