mirror of
https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
synced 2026-09-26 14:42:04 +00:00
@@ -620,10 +620,15 @@
|
||||
")\n",
|
||||
"# Must be the same region as batch_predict_bq_input_uri\n",
|
||||
"client = bigquery.Client(project=PROJECT_ID)\n",
|
||||
"bq_dataset = bigquery.Dataset(batch_predict_bq_output_dataset_path)\n",
|
||||
"bq_dataset_id = bigquery.Dataset(batch_predict_bq_output_dataset_path)\n",
|
||||
"dataset_region = \"US\" # @param {type : \"string\"}\n",
|
||||
"bq_dataset.location = dataset_region\n",
|
||||
"bq_dataset = client.create_dataset(bq_dataset)\n",
|
||||
"bq_dataset_id.location = dataset_region\n",
|
||||
"# delete any existing dataset\n",
|
||||
"try:\n",
|
||||
" client.delete_dataset(bq_dataset_id, delete_contents=True)\n",
|
||||
"except Exception as e:\n",
|
||||
" print(e)\n",
|
||||
"bq_dataset = client.create_dataset(bq_dataset_id)\n",
|
||||
"print(\n",
|
||||
" \"Created bigquery dataset {} in {}\".format(\n",
|
||||
" batch_predict_bq_output_dataset_path, dataset_region\n",
|
||||
@@ -857,6 +862,12 @@
|
||||
"# Delete batch prediction job\n",
|
||||
"batch_prediction_job.delete()\n",
|
||||
"\n",
|
||||
"# Delete the dataset\n",
|
||||
"try:\n",
|
||||
" client.delete_dataset(bq_dataset_id)\n",
|
||||
"except Exception as e:\n",
|
||||
" print(e)\n",
|
||||
"\n",
|
||||
"# Set this to true only if you'd like to delete your bucket\n",
|
||||
"delete_bucket = False\n",
|
||||
"\n",
|
||||
|
||||
Reference in New Issue
Block a user