GCP Tutorial - 20 : How to Create BigQuery table? | BQ Table Creation

Опубликовано: 25 Октябрь 2024
на канале: Swatech Talks
126
6

This tutorial talks about creating a table in BigQuery by specifying the schema

Python code-
from google.cloud import bigquery

client = bigquery.Client()

table_id = "(specify_project_id.specify_dataset_id).customer"

schema = [
bigquery.SchemaField("customer_id", "INTEGER"),
bigquery.SchemaField("customer_name", "STRING"),
bigquery.SchemaField("customer_dob", "DATE")
]

table = bigquery.Table(table_id, schema=schema)
table = client.create_table(table)