To help organize your BigQuery resources, you can add labels to your datasets, tables, and views. Labels are key-value pairs that you can attach to a resource. When you create BigQuery resources, labels are optional.
After labeling your resources, you can search for them based on label values. For example, you can use labels to group datasets by purpose, environment, department, and so on.
What are labels?
A label is a key-value pair that helps you organize your Google Cloud Platform BigQuery resources. You can attach a label to each resource, then filter the resources based on their labels. Information about labels is forwarded to the billing system, so you can break down your billing charges by label.
Common uses of labels
We do not recommend creating large numbers of unique labels, such as for timestamps or individual values for every API call. Here are some common use cases for labels:
Team or cost center labels: Add labels based on team or cost center to distinguish BigQuery resources owned by different teams (for example,
team:analytics). You can use this type of label for cost accounting or budgeting.
Component labels: For example,
Environment or stage labels: For example,
State labels: For example,
Requirements for labels
The labels applied to a resource must meet the following requirements:
- Each resource can have multiple labels, up to a maximum of 64.
- Each label must be a key-value pair.
- Keys have a minimum length of 1 character and a maximum length of 63 characters, and cannot be empty. Values can be empty, and have a maximum length of 63 characters.
- Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
- The key portion of a label must be unique. However, you can use the same key with multiple resources.
- Keys must start with a lowercase letter or international character.
- Learn how to add labels to BigQuery resources.
- Learn how to view labels on BigQuery resources.
- Learn how to update labels on BigQuery resources.
- Learn how to filter resources using labels.
- Learn how to delete labels on BigQuery resources.
- Read about Using labels in the Resource Manager documentation.