If you have existing version 1 (V1) Apache Iceberg tables, you must upgrade
them using your query engine before using them with the Apache Iceberg REST
catalog endpoint. For more information, see [Alter a table](https://docs.cloud.google.com/lakehouse/docs/alter-table.md.txt).

## Before you begin

1.
   [Verify that billing is enabled for your Google Cloud project](https://docs.cloud.google.com/billing/docs/how-to/verify-billing-enabled.md.txt#confirm_billing_is_enabled_on_a_project).

2.


   Enable the BigLake API, if it is not already enabled.


   **Roles required to enable APIs**


   To enable APIs, you need the `serviceusage.services.enable` permission. If you
   created the project, then you likely already have this permission through the
   Owner role (`roles/owner`). Otherwise, you can get this permission through the
   Service Usage Admin role (`roles/serviceusage.serviceUsageAdmin`).
   [Learn how to grant roles](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).

   [Enable the API](https://console.cloud.google.com/apis/enableflow?apiid=biglake.googleapis.com)
3. [Set up the Lakehouse runtime catalog](https://docs.cloud.google.com/lakehouse/docs/set-up-lakehouse-iceberg-rest-catalog.md.txt) with the Apache Iceberg REST catalog endpoint.

### Required roles


To get the permissions that
you need to upgrade a table,

ask your administrator to grant you the
following IAM roles on your project and storage bucket:

- Upgrade table in [credential vending mode](https://docs.cloud.google.com/lakehouse/docs/credential-vending.md.txt): BigLake Editor (`roles/biglake.editor`) - the project
- Upgrade table in non-credential vending mode:
  - BigLake Editor (`roles/biglake.editor`) - the project
  - Storage Object User (`roles/storage.objectUser`) - the Cloud Storage bucket


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


You might also be able to get
the required permissions through [custom
roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles) or other [predefined
roles](https://docs.cloud.google.com/iam/docs/roles-overview#predefined).

## Upgrade a table

To upgrade an Iceberg V1 table to V2, run the following command in your query engine:

### Spark

```sql
ALTER TABLE CATALOG_NAME.SCHEMA_NAME.TABLE_NAME SET TBLPROPERTIES ('format-version'='2');
```

Replace the following:

- `CATALOG_NAME`: the name of your catalog.
- `SCHEMA_NAME`: the name of your schema.
- `TABLE_NAME`: the name of your table.

## What's next

- Learn how to [configure table options](https://docs.cloud.google.com/lakehouse/docs/table-options.md.txt).
- Learn how to [alter a table](https://docs.cloud.google.com/lakehouse/docs/alter-table.md.txt).