This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.cloud import bigquery | |
from google.oauth2 import service_account | |
credentials = service_account.Credentials.from_service_account_file('FILE PATH JSON') | |
project_id = 'PROJECT ID' | |
client = bigquery.Client(credentials = credentials, project = project_id) | |
# Example querying |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Get the column name and data type | |
SELECT column_name, data_type | |
-- From the system database information schema | |
FROM INFORMATION_SCHEMA.COLUMNS | |
-- For the customer table | |
WHERE table_name = <'table_name'>; |