Last active
February 23, 2024 12:55
-
-
Save salvadorgascon/8cf7a825a7f16287742ca1ff422fab7b to your computer and use it in GitHub Desktop.
Create Dataset object in Google Cloud BigQuery
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
BIGQUERY_PROJECT_NAME = "project-XXXXX" |
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.cloud.exceptions import NotFound | |
from shared.loaders.bigquery_constants import BIGQUERY_PROJECT_NAME | |
def BigQueryCreateDataset(bigquery_client, bigquery_dataset_name): | |
print("Creating dataset", bigquery_dataset_name, '...', end='') | |
new_dataset = bigquery.Dataset(f'{BIGQUERY_PROJECT_NAME}.{bigquery_dataset_name}') | |
new_dataset.location = "EU" | |
bigquery_client.create_dataset(new_dataset) | |
print("OK") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment