选择表名称作为BigQuery中的列 [英] Select table name as a column in BigQuery

查看:51
本文介绍了选择表名称作为BigQuery中的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在BigQuery中有一个表,例如table1

I have a table in BigQuery, say table1

我想写

SELECT table1.table_name as Table_Name from table_name

我该怎么做?

推荐答案

如果您想要可以使用元表的行和表名 __ TABLES __ :

I f you want rows and table names you can use meta tables __TABLES__:

SELECT 
  project_id, 
  dataset_id, 
  table_id, 
  row_count 
FROM 
  `bigquery-public-data.covid19_geotab_mobility_impact.__TABLES__` 
LIMIT 
  1000

适用于每个数据集.这些表将来可能会替换为信息模式表 https://cloud.google.com/bigquery/docs/information-schema-简介

Works with every dataset. These tables might get replaced with information schema tables in the future though https://cloud.google.com/bigquery/docs/information-schema-intro

这篇关于选择表名称作为BigQuery中的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆