Copy a BigQuery model into another dataset using bq command line tool

When creating or building a BigQuery Machine Learning model, the model itself is stored inside a BigQuery dataset.

The code snippet below shows how to move a model from one dataset to another should the need arise using the bq command line tool:

PROJECT="my_gcp_project"
OLD_DATASET="gcp_project_old"
NEW_DATASET="gcp_project_new"
MODEL_NAME="classification_model"


# copy a BigQuery ML model into another dataset
bq \
--location=US \
cp -f -n \
$PROJECT:$OLD_DATASET.$MODEL_NAME \
$PROJECT:$NEW_DATASET.$MODEL_NAME

Send a Comment

Your email address will not be published.