Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BigQuery - Get the total number of columns in a BigQuery table

Is there a way to query the total number of columns in a BigQuery table? I went through the BigQuery documentation but did not find anything relevant.

Thanks in advance!

like image 958
activelearner Avatar asked May 20 '15 22:05

activelearner


1 Answers

Using SQL query & built-in INFORMATION_SCHEMA tables:

SELECT count(distinct column_name) 
FROM  `project_id`.name_of_dataset.INFORMATION_SCHEMA.COLUMNS
WHERE table_name = "name_of_table"
like image 112
Katy Q. Avatar answered Sep 19 '22 22:09

Katy Q.