Home » Bigquery » Tutorials » Alter table set options

BigQuery Alter table set options

Sets options on BigQuery table

Alter table set options example

\n    ALTER TABLE mydataset.mypartitionedtable\n    SET OPTIONS (require_partition_filter=true)\n
\n\n

Example 2: Set table expiration timestamp and description

\n
\n    ALTER TABLE mydataset.mytable\n    SET OPTIONS (\n      expiration_timestamp=TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL 7 DAY),\n      description="Table that expires seven days from now"\n    )\n
\n\n

Example 3: Removing expiration timestamp

\n
\n    ALTER TABLE mydataset.mytable\n    SET OPTIONS (expiration_timestamp=NULL)\n

Explanation

table_set_options_list options

\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
OptionVALUEExplnation
default_kms_key_nameSTRINGSpecifies the default Cloud KMS key for encrypting table data\n in this dataset. You can override this value when you create a table.
default_partition_expiration_daysFLOAT64Specifies the default expiration time, in days, for table partitions in\n this dataset. You can override this value when you create a table.
default_table_expiration_daysFLOAT64Specifies the default expiration time, in days, for tables in this\n dataset. You can override this value when you create a table.
descriptionSTRINGThe description of the dataset.
friendly_nameSTRINGA descriptive name for the dataset.
labels<ARRAY<STRUCT<STRING, STRING>>>An array of labels for the dataset, expressed as key-value pairs.
locationSTRINGThe location in which to create the dataset. If you don't specify this\n option, the dataset is created in the location where the query runs. If\n you specify this option and also explicitly set the location for the query\n job, the two values must match; otherwise the query fails.

Syntax reference

ALTER TABLE [IF EXISTS] [[project_name.]dataset_name.]table_name\nSET OPTIONS(table_set_options_list)