Create a table in BigQuery dataset in Google Cloud Platform (GCP)


Google's BigQuery is an enterprise data warehouse that can execute SQL queries in rapid time. It is highly scalable and runs on Google's infrastructure.

Datasets are top-level containers which contains tables and views. A dataset may contain one or more tables.

IoT Cloud Tester  application provides an easy interface to create a table in a BigQuery dataset in the Google Cloud Platform.

To create a table in a BigQuery dataset,

  • In the 'Data Models' tab, create a data model that will serve as the schema for the table
  • In the 'Big Query' tab, click on 'Tables' tab.
  • Get the available datasets for the project
  • Select a dataset
  • Click on 'Add Table' and enter the Table Id
  • Select the schema for the table

First a data model called 'employee' is created.

Then the table 'employee' is created under the dataset 'company'. The table uses the data model 'employee' as the schema.

A POST request is made to create the table. The table schema and the table Id are passed as JSON post data.

POST https://bigquery.googleapis.com/bigquery/v2/projects/second-inquiry-315605/datasets/company/tables HTTP/1.1

Server response to create a new table

{"schema":{"fields":[{"name":"first_name","type":"STRING"},{"name":"last_name","type":"STRING"},{"name":"age","type":"INTEGER"},{"name":"weight","type":"INTEGER"}]},"tableReference":{"tableId":"employee"}}

{

"kind": "bigquery#table",

"etag": "q1B8p3ClvXUOVByVtlRWbw==",

"id": "second-inquiry-315605:company.employee",

"selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/second-inquiry-315605/datasets/company/tables/employee",

"tableReference": {

"projectId": "second-inquiry-315605",

"datasetId": "company",

"tableId": "employee"

},

"schema": {

"fields": [

{

"name": "first_name",

"type": "STRING"

},

{

"name": "last_name",

"type": "STRING"

},

{

"name": "age",

"type": "INTEGER"

},

{

"name": "weight",

"type": "INTEGER"

}

]

},

"numBytes": "0",

"numLongTermBytes": "0",

"numRows": "0",

"creationTime": "1628353587167",

"lastModifiedTime": "1628353587198",

"type": "TABLE",

"location": "US"

}

The newly added table can be viewed in the Google console,