The EXPORT MODEL statement

To export an existing model from BigQuery ML toCloud Storage, use theEXPORT MODELstatement.

For more information about supported model types, formats, and limitations, seeExport models.

For more information about supported SQL statements and functions for exportablemodels, see the following documents:

Syntax

The following is the syntax ofEXPORT MODEL for a regular model that is not generated from BigQuery ML hyperparameter tuning.

EXPORTMODELMODEL_NAME[OPTIONS(URI=STRING_VALUE)]
  • MODEL_NAME is the name of the BigQuery MLmodel you're exporting. If you are exporting a model in another project,you must specify the project, dataset, and model in the following format,including backticks:

    `PROJECT.DATASET.MODEL`

    For example,`myproject.mydataset.mymodel`.

    If the model name does not exist in the dataset, the following error isreturned:

    Error: Not found: Model myproject:mydataset.mymodel

  • STRING_VALUE is theURI of a Cloud Storage bucket where the modelis exported. This option is required for theEXPORT MODEL statement. Forexample:

    URI='gs://bucket/path/to/saved_model/'

For a model that is generated from BigQuery ML hyperparameter tuning,EXPORT MODEL can also export an individual trial to a destination URI. For example:

EXPORTMODELMODEL_NAME[OPTIONS(URI=STRING_VALUE[,TRIAL_ID=INT_VALUE])]
  • INT_VALUE is the numeric ID of the exporting trial.For example:

    ```sqlTRIAL_ID = 12```
  • IfTRIAL_ID is not specified, then the optimal trial is exported by default.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-11-24 UTC.