{"id":192809,"date":"2021-08-07T09:38:57","date_gmt":"2021-08-07T16:38:57","guid":{"rendered":"https:\/\/m2msupport.net\/m2msupport\/?page_id=192809"},"modified":"2021-08-07T09:44:18","modified_gmt":"2021-08-07T16:44:18","slug":"create-a-table-in-bigquery-dataset-in-google-cloud-platform-gcp","status":"publish","type":"page","link":"https:\/\/m2msupport.net\/m2msupport\/create-a-table-in-bigquery-dataset-in-google-cloud-platform-gcp\/","title":{"rendered":"Create a table in BigQuery dataset in Google Cloud Platform (GCP)"},"content":{"rendered":"<p>Google&#8217;s BigQuery is an enterprise data warehouse that can execute SQL queries in rapid time. It is highly scalable and runs on Google&#8217;s infrastructure.<\/p>\n<p>Datasets are top-level containers which contains tables and views. A dataset may contain one or more tables.<\/p>\n<p><a href=\"https:\/\/m2msupport.net\/m2msupport\/download-iot-cloud-tester\/\">IoT Cloud Tester<\/a>\u00a0 application provides an easy interface to create a table in a BigQuery dataset in the Google Cloud Platform.<\/p>\n<h1>To create a table in a BigQuery dataset,<\/h1>\n<ul>\n<li>In the &#8216;Data Models&#8217; tab, create a data model that will serve as the schema for the table<\/li>\n<li>In the &#8216;Big Query&#8217; tab, click on &#8216;Tables&#8217; tab.<\/li>\n<li>Get the available datasets for the project<\/li>\n<li>Select a dataset<\/li>\n<li>Click on &#8216;Add Table&#8217; and enter the Table Id<\/li>\n<li>Select the schema for the table<\/li>\n<\/ul>\n<p>First a data model called &#8217;employee&#8217; is created.<\/p>\n<p><a href=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_data_model.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-192811\" src=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_data_model.png\" alt=\"\" width=\"876\" height=\"768\" srcset=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_data_model.png 876w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_data_model-300x263.png 300w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_data_model-768x673.png 768w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_data_model-600x526.png 600w\" sizes=\"auto, (max-width: 876px) 100vw, 876px\" \/><\/a><\/p>\n<p>Then the table &#8217;employee&#8217; is created under the dataset &#8216;company&#8217;. The table uses the data model &#8217;employee&#8217; as the schema.<\/p>\n<p><a href=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-192812\" src=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table.png\" alt=\"\" width=\"847\" height=\"728\" srcset=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table.png 847w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table-300x258.png 300w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table-768x660.png 768w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table-600x516.png 600w\" sizes=\"auto, (max-width: 847px) 100vw, 847px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-192813\" src=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table2.png\" alt=\"\" width=\"835\" height=\"654\" srcset=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table2.png 835w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table2-300x235.png 300w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table2-768x602.png 768w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table2-600x470.png 600w\" sizes=\"auto, (max-width: 835px) 100vw, 835px\" \/><\/a><\/p>\n<p>A POST request is made to create the table. The table schema and the table Id are passed as JSON post data.<\/p>\n<p>POST https:\/\/bigquery.googleapis.com\/bigquery\/v2\/projects\/second-inquiry-315605\/datasets\/company\/tables HTTP\/1.1<\/p>\n<p><strong>Server response to create a new table<\/strong><\/p>\n<p>{&#8220;schema&#8221;:{&#8220;fields&#8221;:[{&#8220;name&#8221;:&#8221;first_name&#8221;,&#8221;type&#8221;:&#8221;STRING&#8221;},{&#8220;name&#8221;:&#8221;last_name&#8221;,&#8221;type&#8221;:&#8221;STRING&#8221;},{&#8220;name&#8221;:&#8221;age&#8221;,&#8221;type&#8221;:&#8221;INTEGER&#8221;},{&#8220;name&#8221;:&#8221;weight&#8221;,&#8221;type&#8221;:&#8221;INTEGER&#8221;}]},&#8221;tableReference&#8221;:{&#8220;tableId&#8221;:&#8221;employee&#8221;}}<\/p>\n<p>{<\/p>\n<p>&#8220;kind&#8221;: &#8220;bigquery#table&#8221;,<\/p>\n<p>&#8220;etag&#8221;: &#8220;q1B8p3ClvXUOVByVtlRWbw==&#8221;,<\/p>\n<p>&#8220;id&#8221;: &#8220;second-inquiry-315605:company.employee&#8221;,<\/p>\n<p>&#8220;selfLink&#8221;: &#8220;https:\/\/bigquery.googleapis.com\/bigquery\/v2\/projects\/second-inquiry-315605\/datasets\/company\/tables\/employee&#8221;,<\/p>\n<p>&#8220;tableReference&#8221;: {<\/p>\n<p>&#8220;projectId&#8221;: &#8220;second-inquiry-315605&#8221;,<\/p>\n<p>&#8220;datasetId&#8221;: &#8220;company&#8221;,<\/p>\n<p>&#8220;tableId&#8221;: &#8220;employee&#8221;<\/p>\n<p>},<\/p>\n<p>&#8220;schema&#8221;: {<\/p>\n<p>&#8220;fields&#8221;: [<\/p>\n<p>{<\/p>\n<p>&#8220;name&#8221;: &#8220;first_name&#8221;,<\/p>\n<p>&#8220;type&#8221;: &#8220;STRING&#8221;<\/p>\n<p>},<\/p>\n<p>{<\/p>\n<p>&#8220;name&#8221;: &#8220;last_name&#8221;,<\/p>\n<p>&#8220;type&#8221;: &#8220;STRING&#8221;<\/p>\n<p>},<\/p>\n<p>{<\/p>\n<p>&#8220;name&#8221;: &#8220;age&#8221;,<\/p>\n<p>&#8220;type&#8221;: &#8220;INTEGER&#8221;<\/p>\n<p>},<\/p>\n<p>{<\/p>\n<p>&#8220;name&#8221;: &#8220;weight&#8221;,<\/p>\n<p>&#8220;type&#8221;: &#8220;INTEGER&#8221;<\/p>\n<p>}<\/p>\n<p>]<\/p>\n<p>},<\/p>\n<p>&#8220;numBytes&#8221;: &#8220;0&#8221;,<\/p>\n<p>&#8220;numLongTermBytes&#8221;: &#8220;0&#8221;,<\/p>\n<p>&#8220;numRows&#8221;: &#8220;0&#8221;,<\/p>\n<p>&#8220;creationTime&#8221;: &#8220;1628353587167&#8221;,<\/p>\n<p>&#8220;lastModifiedTime&#8221;: &#8220;1628353587198&#8221;,<\/p>\n<p>&#8220;type&#8221;: &#8220;TABLE&#8221;,<\/p>\n<p>&#8220;location&#8221;: &#8220;US&#8221;<\/p>\n<p>}<\/p>\n<p>The newly added table can be viewed in the Google console,<\/p>\n<p><a href=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-192815\" src=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table3.png\" alt=\"\" width=\"1287\" height=\"885\" srcset=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table3.png 1287w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table3-300x206.png 300w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table3-768x528.png 768w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table3-1024x704.png 1024w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/08\/add_table3-600x413.png 600w\" sizes=\"auto, (max-width: 1287px) 100vw, 1287px\" \/><\/a><\/p>\n<div class=\"video-responsive\"><iframe loading=\"lazy\" id=\"youTubePlayer\" src=\"https:\/\/www.youtube.com\/embed\/G-i6kA8OftQ?hd=1\" width=\"750\" height=\"421\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Google&#8217;s BigQuery is an enterprise data warehouse that can execute SQL queries in rapid time. It is highly scalable and runs on Google&#8217;s infrastructure. Datasets are top-level containers which contains tables and views. A dataset may contain one or more &hellip; <a href=\"https:\/\/m2msupport.net\/m2msupport\/create-a-table-in-bigquery-dataset-in-google-cloud-platform-gcp\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"iot_tutorial_template.php","meta":{"footnotes":""},"class_list":["post-192809","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages\/192809","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/comments?post=192809"}],"version-history":[{"count":3,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages\/192809\/revisions"}],"predecessor-version":[{"id":192818,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages\/192809\/revisions\/192818"}],"wp:attachment":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/media?parent=192809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}