Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Introduzione alle etichette
Per organizzare le risorse BigQuery, puoi aggiungere etichette ai set di dati, alle tabelle, alle prenotazioni e alle viste. Le etichette sono coppie chiave-valore che puoi collegare
a una risorsa. Quando crei risorse BigQuery, le etichette sono facoltative.
Dopo aver etichettato le risorse, puoi cercarle in base ai valori delle etichette.
Ad esempio, puoi utilizzare le etichette per raggruppare i set di dati in base a scopo, ambiente, reparto e così via.
Cosa sono le etichette?
Un'etichetta è una coppia chiave-valore che puoi assegnare alle Google Cloud risorse BigQuery.
Ti aiutano a organizzare queste risorse e a gestire i costi su larga scala, con la granularità di cui hai bisogno. Puoi associare un'etichetta a ogni risorsa e poi filtrare le risorse in base alle etichette. Le informazioni relative alle etichette vengono inoltrate al sistema di fatturazione, che consente di suddividere gli addebiti fatturati per etichetta. Con i report di fatturazione integrati, puoi filtrare e raggruppare i costi in base alle etichette delle risorse. Puoi anche utilizzare le etichette per eseguire query sulle esportazioni dei dati di fatturazione.
Requisiti per le etichette
Le etichette applicate a una risorsa devono soddisfare i seguenti requisiti:
Ogni risorsa può avere fino a 64 etichette.
Ogni etichetta deve essere una coppia chiave-valore.
Le chiavi hanno una lunghezza minima di 1 carattere e una massima di 63 caratteri e non possono essere vuote. I valori possono essere vuoti e avere una lunghezza massima di 63 caratteri.
Le chiavi e i valori possono contenere solo lettere minuscole, caratteri numerici, trattini bassi e trattini. Tutti i caratteri devono utilizzare la codifica UTF-8 e sono consentiti caratteri internazionali. Le chiavi devono iniziare con una lettera minuscola o un carattere internazionale.
La parte della chiave di un'etichetta deve essere univoca all'interno di una singola risorsa.
Tuttavia, puoi utilizzare la stessa chiave con più risorse.
Questi limiti si applicano alla chiave e al valore di ogni etichetta e alle singole Google Cloud risorse che hanno etichette. Non esiste un limite al numero di etichette che puoi applicare a tutte le risorse all'interno di un progetto.
Utilizzi comuni delle etichette
Ecco alcuni casi d'uso comuni per le etichette:
Etichette di team o centro di costo: aggiungi etichette in base al team o al centro di costo per distinguere le risorse BigQuery di proprietà di team diversi (ad es. team:research e team:analytics). Puoi utilizzare questo tipo di etichetta per la contabilità dei costi o la definizione del budget.
Etichette dei componenti: ad esempio component:redis,
component:frontend, component:ingest e component:dashboard.
Etichette di ambiente o fase: ad esempio,environment:production e environment:test.
Etichette di stato: ad esempio state:active,
state:readytodelete e state:archive.
Etichette di proprietà: utilizzate per identificare i team responsabili delle operazioni, ad esempio: team:shopping-cart.
Non è consigliabile creare un numero elevato di etichette univoche, ad esempio per i timestamp o i singoli valori per ogni chiamata API.
Il problema di questo approccio è che, quando i valori cambiano di frequente o con chiavi che ingombrano il catalogo, diventa difficile filtrare e generare report sulle risorse in modo efficace.
Etichette e tag
Le etichette possono essere utilizzate come annotazioni interrogabili per le risorse, ma non possono essere utilizzate per impostare condizioni sui criteri. I tag forniscono un modo per consentire o negare in modo condizionale i criteri a seconda che una risorsa abbia un tag specifico, offrendo un controllo granulare sui criteri. Per ulteriori informazioni, consulta la panoramica dei tag.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eLabels are key-value pairs that can be added to BigQuery datasets, tables, and views to help organize and manage resources.\u003c/p\u003e\n"],["\u003cp\u003eLabels enable users to filter and group resources by various criteria, such as team, environment, or cost center, and can be used to break down billed charges.\u003c/p\u003e\n"],["\u003cp\u003eEach resource can have up to 64 labels, with key and value constraints on length and characters, and keys must be unique within a resource.\u003c/p\u003e\n"],["\u003cp\u003eCommon uses for labels include identifying teams, components, environments, states, and ownership, while it's advised to avoid using them for sensitive data or large numbers of unique labels.\u003c/p\u003e\n"],["\u003cp\u003eWhile labels are used for organizing and querying, tags provide a means for conditionally allowing or denying policies based on if a resource has a specific tag.\u003c/p\u003e\n"]]],[],null,["# Introduction to labels\n======================\n\nTo help organize your BigQuery resources, you can add labels to\nyour datasets, tables, reservations, and views. Labels are key-value pairs that you can attach\nto a resource. When you create BigQuery resources, labels are\noptional.\n\nAfter labeling your resources, you can search for them based on label values.\nFor example, you can use labels to group datasets by purpose, environment,\ndepartment, and so on.\n\nWhat are labels?\n----------------\n\nA label is a key-value pair that you can assign to Google Cloud BigQuery resources.\nThey help you organize these resources and manage your costs at scale, with the\ngranularity you need. You can attach a label to each resource, then filter the\nresources based on their labels. Information about labels is forwarded to the billing system that\nlets you break down your billed charges by label. With built-in [billing reports](/billing/docs/how-to/reports),\nyou can filter and group costs by resource labels. You can also use labels to\nquery [billing data exports](/billing/docs/how-to/bq-examples).\n\nRequirements for labels\n-----------------------\n\nThe labels applied to a resource must meet the following\nrequirements:\n\n- Each resource can have up to 64 labels.\n- Each label must be a key-value pair.\n- 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.\n- 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. Keys must start with a lowercase letter or international character.\n- The key portion of a label must be unique within a single resource. However, you can use the same key with multiple resources.\n\nThese limits apply to the key and value for each label, and to the\nindividual Google Cloud resources that have labels. There\nis no limit on how many labels you can apply across all resources\nwithin a project.\n\nCommon uses of labels\n---------------------\n\nHere are some common use cases for labels:\n\n- **Team or cost center labels** : Add labels based on team or\n cost center to distinguish BigQuery resources owned by different\n teams (for example, `team:research` and `team:analytics`). You can use this\n type of label for cost accounting or budgeting.\n\n- **Component labels** : For example, `component:redis`,\n `component:frontend`, `component:ingest`, and `component:dashboard`.\n\n- **Environment or stage labels** : For example,\n `environment:production` and `environment:test`.\n\n- **State labels** : For example, `state:active`,\n `state:readytodelete`, and `state:archive`.\n\n- **Ownership labels** : Used to identify the teams that are\n responsible for operations, for example: `team:shopping-cart`.\n\n\n| **Note:** Don't include sensitive information in labels, including personally identifiable information, such as an individual's name or title. Labels are not designed to handle sensitive information.\n\nWe don't recommend creating large numbers of unique labels, such as\nfor timestamps or individual values for every API call.\nThe problem with this approach is that when the values change frequently or with\nkeys that clutter the catalog, this makes it difficult to effectively filter and\nreport on resources.\n\nLabels and tags\n---------------\n\nLabels can be used as queryable annotations for resources, but can't be used\nto set conditions on policies. Tags provide a way to conditionally allow or\ndeny policies based on whether a resource has a specific tag, by providing fine-grained\ncontrol over policies. For more information, see the\n[Tags overview](/resource-manager/docs/tags/tags-overview).\n\nWhat's next\n-----------\n\n- Learn how to [add labels](/bigquery/docs/adding-labels) to BigQuery resources.\n- Learn how to [view labels](/bigquery/docs/viewing-labels) on BigQuery resources.\n- Learn how to [update labels](/bigquery/docs/updating-labels) on BigQuery resources.\n- Learn how to [filter resources using labels](/bigquery/docs/filtering-labels).\n- Learn how to [delete labels](/bigquery/docs/deleting-labels) on BigQuery resources.\n- Read about [Using labels](/resource-manager/docs/using-labels) in the Resource Manager documentation."]]