From f05ca4d06a53bd6d45a36f1b4f82a2cd10701e43 Mon Sep 17 00:00:00 2001 From: Ivan Cheung Date: Wed, 16 Feb 2022 16:27:08 -0500 Subject: [PATCH] Added project to BQ client instantiation (#285) --- .../automl/sdk_automl_tabular_forecasting_batch.ipynb | 2 +- .../official/custom/custom-tabular-bq-managed-dataset.ipynb | 4 ++-- .../official/ml_metadata/vertex-pipelines-ml-metadata.ipynb | 2 +- .../pipelines/automl_tabular_classification_beans.ipynb | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/notebooks/official/automl/sdk_automl_tabular_forecasting_batch.ipynb b/notebooks/official/automl/sdk_automl_tabular_forecasting_batch.ipynb index 75f656394..d1894b4d0 100644 --- a/notebooks/official/automl/sdk_automl_tabular_forecasting_batch.ipynb +++ b/notebooks/official/automl/sdk_automl_tabular_forecasting_batch.ipynb @@ -786,7 +786,7 @@ " PROJECT_ID, batch_predict_bq_output_dataset_name\n", ")\n", "# Must be the same region as batch_predict_bq_input_uri\n", - "client = bigquery.Client()\n", + "client = bigquery.Client(project=PROJECT_ID)\n", "bq_dataset = bigquery.Dataset(batch_predict_bq_output_dataset_path)\n", "dataset_region = \"US\" # @param {type : \"string\"}\n", "bq_dataset.location = dataset_region\n", diff --git a/notebooks/official/custom/custom-tabular-bq-managed-dataset.ipynb b/notebooks/official/custom/custom-tabular-bq-managed-dataset.ipynb index 5d9c9ffa9..f4a2505dd 100644 --- a/notebooks/official/custom/custom-tabular-bq-managed-dataset.ipynb +++ b/notebooks/official/custom/custom-tabular-bq-managed-dataset.ipynb @@ -273,7 +273,7 @@ "\n", "if not os.getenv(\"IS_TESTING\"):\n", " # Get your Google Cloud project ID from gcloud\n", - " shell_output=!gcloud config list --format 'value(core.project)' 2>/dev/null\n", + " shell_output = !gcloud config list --format 'value(core.project)' 2>/dev/null\n", " PROJECT_ID = shell_output[0]\n", " print(\"Project ID: \", PROJECT_ID)" ] @@ -674,7 +674,7 @@ "NA_VALUES = [\"NA\", \".\"]\n", "\n", "# Set up BigQuery clients\n", - "bqclient = bigquery.Client()\n", + "bqclient = bigquery.Client(project=PROJECT_ID)\n", "\n", "\n", "# Download a table\n", diff --git a/notebooks/official/ml_metadata/vertex-pipelines-ml-metadata.ipynb b/notebooks/official/ml_metadata/vertex-pipelines-ml-metadata.ipynb index 46817404b..9c2871fe9 100644 --- a/notebooks/official/ml_metadata/vertex-pipelines-ml-metadata.ipynb +++ b/notebooks/official/ml_metadata/vertex-pipelines-ml-metadata.ipynb @@ -657,7 +657,7 @@ "def get_dataframe(bq_table: str, output_data_path: OutputPath(\"Dataset\")):\n", " from google.cloud import bigquery\n", "\n", - " bqclient = bigquery.Client()\n", + " bqclient = bigquery.Client(project=PROJECT_ID)\n", " table = bigquery.TableReference.from_string(bq_table)\n", " rows = bqclient.list_rows(table)\n", " dataframe = rows.to_dataframe(\n", diff --git a/notebooks/official/pipelines/automl_tabular_classification_beans.ipynb b/notebooks/official/pipelines/automl_tabular_classification_beans.ipynb index a03be1c7d..171e9b6eb 100644 --- a/notebooks/official/pipelines/automl_tabular_classification_beans.ipynb +++ b/notebooks/official/pipelines/automl_tabular_classification_beans.ipynb @@ -309,7 +309,7 @@ }, "outputs": [], "source": [ - "PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\"}" + "PROJECT_ID = \"python-docs-samples-tests\" # @param {type:\"string\"}" ] }, { @@ -320,7 +320,7 @@ }, "outputs": [], "source": [ - "if PROJECT_ID == \"\" or PROJECT_ID is None or PROJECT_ID == \"[your-project-id]\":\n", + "if PROJECT_ID == \"\" or PROJECT_ID is None or PROJECT_ID == \"python-docs-samples-tests\":\n", " # Get your GCP project id from gcloud\n", " shell_output = ! gcloud config list --format 'value(core.project)' 2>/dev/null\n", " PROJECT_ID = shell_output[0]\n",