Creating and Using Datasets

This document describes how to create and use datasets in BigQuery. After creating a dataset, you can:

  • Assign access controls to your datasets
  • Get information about your datasets
  • List your datasets
  • Get dataset metadata using meta-tables

For information on managing datasets including updating dataset properties, renaming datasets, deleting datasets, and copying datasets, see Managing Datasets.

Dataset limitations

BigQuery datasets are subject to the following limitations:

  • You can set the geographic location at creation time only. After a dataset has been created, the location becomes immutable and can't be changed in the BigQuery web UI, the command-line tool, or by calling the patch or update API methods.
  • All tables referenced in a query must be stored in datasets in the same location.

  • When copying a table, the datasets containing the source table and destination table must reside in the same location.

  • Dataset names must be unique per project.
  • As you approach thousands of datasets in a project, web UI performance begins to degrade, and listing datasets becomes slower.

Creating datasets

You can create datasets using the BigQuery web UI, using the bq mk CLI command or by calling the datasets.insert API method.

When you create a dataset in BigQuery, the dataset name must be unique per project. The dataset name:

  • May contain up to 1,024 characters
  • Can contain letters (upper or lower case), numbers, and underscores
  • Is case-sensitive (mydataset and MyDataset can co-exist in the same project)

Dataset names cannot:

  • Contain spaces or special characters (such as -, &, @, or %)

Required permissions

To create a dataset, you must be assigned a project-level primitive role or a predefined IAM role that provides bigquery.datasets.create permissions. The following predefined, project-level IAM roles include bigquery.datasets.create permissions:

For more information on IAM roles and permissions in BigQuery, see Access Control.

Creating a dataset

To create a dataset:

Web UI

  1. Click the down arrow icon down arrow icon next to your project name in the navigation and click Create new dataset.

  2. In the Create Dataset dialog:

    • For Dataset ID, enter a unique dataset name.
    • For Data location, choose a location for the dataset. The default value is Unspecified which sets the dataset location to US. After a dataset is created, the location can't be changed.

    • For Data expiration, choose one of the following options:

      • Never: (Default) Tables created in the dataset are never automatically deleted. You must delete them manually.
      • In [INTEGER] days: Any table created in the dataset is deleted after [INTEGER] days from its creation time. This value is applied if you do not set a table expiration when the table is created.

        Create dataset

    • Click OK.

Command-line

Use the bq mk command with the --location flag to create a new dataset. Optional parameters include --default_table_expiration and --description. To create a dataset in a project other than your default project, add the project ID to the dataset name in the following format: [PROJECT_ID]:[DATASET].
bq --location=[LOCATION] mk --dataset --default_table_expiration [INTEGER] --description [DESCRIPTION] [PROJECT_ID]:[DATASET]

Where:

  • [LOCATION] is the dataset's location. After a dataset is created, the location can't be changed. You can set a default value for the location using the .bigqueryrc file.

  • [INTEGER] is the default lifetime (in seconds) for newly-created tables. The minimum value is 3600 seconds (one hour). The expiration time evaluates to the current time plus the integer value. Any table created in the dataset is deleted after [INTEGER] seconds from its creation time. This value is applied if you do not set a table expiration when the table is created.

  • [DESCRIPTION] is a description of the dataset in quotes.
  • [PROJECT_ID] is your project ID.
  • [DATASET] is the name of the dataset you're creating.

For example, the following command creates a dataset named mydataset with data location set to US, a default table expiration of 3600 seconds (1 hour), and a description of This is my dataset. Instead of using the --dataset flag, the command uses the -d shortcut. If you omit -d and --dataset, the command defaults to creating a dataset.

bq --location=US mk -d --default_table_expiration 3600 --description "This is my dataset." mydataset

You can enter the bq ls command to confirm that the dataset was created. Also, you can create a table when you create a new dataset using the format: bq mk -t [DATASET].[TABLE]. For more information on creating tables, see Creating a table.

API

Call the datasets.insert method with a defined dataset resource.

C#

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

public void CreateDataset(string datasetId, BigQueryClient client)
{
    var dataset = client.GetOrCreateDataset(datasetId);
}

Go

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

meta := &bigquery.DatasetMetadata{
	Location: "US", // Create the dataset in the US.
}
if err := client.Dataset(datasetID).Create(ctx, meta); err != nil {
	return err
}

Java

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

Dataset dataset = null;
DatasetInfo datasetInfo = DatasetInfo.newBuilder(datasetName).build();
try {
  // the dataset was created
  dataset = bigquery.create(datasetInfo);
} catch (BigQueryException e) {
  // the dataset was not created
}

Node.js

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

// Imports the Google Cloud client library
const BigQuery = require('@google-cloud/bigquery');

/**
 * TODO(developer): Uncomment the following lines before running the sample.
 */
// const projectId = "your-project-id";
// const datasetId = "my_new_dataset";

// Creates a client
const bigquery = new BigQuery({
  projectId: projectId,
});

// Creates a new dataset
bigquery
  .createDataset(datasetId)
  .then(results => {
    const dataset = results[0];
    console.log(`Dataset ${dataset.id} created.`);
  })
  .catch(err => {
    console.error('ERROR:', err);
  });

PHP

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

use Google\Cloud\BigQuery\BigQueryClient;

/**
 * @param string $projectId The Google project ID.
 * @param string $dataset   The BigQuery dataset ID.
 */
function create_dataset($projectId, $datasetId)
{
    $bigQuery = new BigQueryClient([
        'projectId' => $projectId,
    ]);
    $dataset = $bigQuery->createDataset($datasetId);
    return $dataset;
}

Python

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

# from google.cloud import bigquery
# client = bigquery.Client()
# dataset_id = 'my_dataset'

# Create a DatasetReference using a chosen dataset ID.
# The project defaults to the Client's project if not specified.
dataset_ref = client.dataset(dataset_id)

# Construct a full Dataset object to send to the API.
dataset = bigquery.Dataset(dataset_ref)
# Specify the geographic location where the dataset should reside.
dataset.location = 'US'

# Send the dataset to the API for creation.
# Raises google.api_core.exceptions.AlreadyExists if the Dataset already
# exists within the project.
dataset = client.create_dataset(dataset)  # API request

Ruby

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

# project_id = "Your Google Cloud project ID"
# dataset_id = "ID of the dataset to create"

require "google/cloud/bigquery"

bigquery = Google::Cloud::Bigquery.new project: project_id

bigquery.create_dataset dataset_id

puts "Created dataset: #{dataset_id}"

Assigning access controls to datasets

You share access to BigQuery tables and views using project- level IAM roles and dataset-level access controls. Currently, you cannot apply access controls directly to tables or views.

Project-level access controls determine the users, groups, and service accounts allowed to access all datasets, tables, views, and table data within a project. Dataset-level access controls determine the users, groups, and service accounts allowed to access the tables, views, and table data in a specific dataset.

For example, if you assign the bigquery.dataOwner role to a user at the project level, that user can create, update, and delete tables and views in all of the project's datasets. If you assign the OWNER role at the dataset level, the user can create, update, and delete tables and views only in that dataset. The dataset-level OWNER primitive role is equivalent to granting the bigquery.dataOwner role to the dataset.

If you assign users or groups to a more restrictive role at the project level, you must also grant access to individual datasets. For example, if you grant a user or group the bigquery.user role at the project level, the user can create datasets and can run query jobs against tables in those datasets. To query tables in datasets the user did not create, you must assign a minimum of dataset-level READER access to the user for each dataset the user needs to query. The dataset-level READER primitive role is equivalent to granting the bigquery.dataViewer role to the dataset.

For more information about predefined, project-level IAM roles and dataset-level access controls, see Access Control.

Required permissions

To assign or update dataset access controls, you must have OWNER access at the dataset level, or you must be assigned a project-level IAM role that includes bigquery.datasets.update permissions. The following predefined, project-level IAM roles include bigquery.datasets.update permissions:

In addition, because the bigquery.user role has bigquery.datasets.create permissions, a user assigned to the bigquery.user role can update any dataset that user creates. When a user assigned to the bigquery.user role creates a dataset, that user is given OWNER access to the dataset. OWNER access to a dataset gives the user full control over it.

For more information on IAM roles and permissions in BigQuery, see Access Control. For more information on dataset-level roles, see Primitive roles for datasets.

Controlling access to a dataset

You can apply access controls to a dataset after it is created using the BigQuery web UI or the bq update CLI command. Access controls cannot be applied during dataset creation in the UI or command-line tool.

Using the API, you can apply access controls during dataset creation by calling the datasets.insert method, or you can apply access controls after dataset creation by calling the datasets.patch method.

When you apply access controls to a dataset, you can grant access to the following users and groups:

  • User by e-mail - Gives an individual Google account access to the dataset
  • Group by e-mail - Gives all members of a Google group access to the dataset
  • Domain - Gives all users and groups in a Google domain access to the dataset
  • All Authenticated Users - Gives all Google account holders access to the dataset (makes the dataset public)
  • Project Owners - Gives all project owners access to the dataset
  • Project Viewers - Gives all project viewers access to the dataset
  • Project Editors - Gives all project editors access to the dataset
  • Authorized View - Gives a view access to the dataset

To assign access controls to a dataset:

Web UI

  1. Click the drop-down arrow to the right of the dataset and choose Share Dataset.

  2. In the Share Dataset dialog, for Add People, click the drop-down to the left of the field, and choose the appropriate option.

  3. Type a value in the text box. For example, if you choose User by e-mail or Group by e-mail, type the user or group's email address.

  4. To the right of the Add People field, click Can view and choose the appropriate role from the list.

    Add people to dataset

  5. Click Add and then click Save changes.

Command-line

  1. Write the existing dataset information (including access controls) to a JSON file using the show command. If the dataset is in a project other than your default project, add the project ID to the dataset name in the following format: [PROJECT_ID]:[DATASET].

    bq show --format=prettyjson [PROJECT_ID]:[DATASET] > [PATH_TO_FILE]
    

    Where:

    • [PROJECT_ID] is your project ID.
    • [DATASET] is the name of your dataset.
    • [PATH_TO_FILE] is the path to the JSON file on your local machine.

    Examples:

    Enter the following command to write the access controls for mydataset to a JSON file. mydataset is in your default project.

    bq show --format=prettyjson mydataset > /tmp/mydataset.json
    

    Enter the following command to write the access controls for mydataset to a JSON file. mydataset is in myotherproject.

    bq show --format=prettyjson myotherproject:mydataset > /tmp/mydataset.json
    
  2. Make your changes to the "access" section of the JSON file. You can add or remove any of the specialGroup entries: projectOwners, projectWriters, projectReaders, and allAuthenticatedUsers. You can also add, remove, or modify any of the following: userByEmail, groupByEmail, and domain.

    For example, the access section of a dataset's JSON file would look like the following:

    {
     "access": [
      {
       "role": "READER",
       "specialGroup": "projectReaders"
      },
      {
       "role": "WRITER",
       "specialGroup": "projectWriters"
      },
      {
       "role": "OWNER",
       "specialGroup": "projectOwners"
      },
      {
       "role": "READER",
       "specialGroup": "allAuthenticatedUsers"
      },
      {
       "role": "READER",
       "domain": "[DOMAIN_NAME]"
      },
      {
       "role": "WRITER",
       "userByEmail": "[USER_EMAIL]"
      },
      {
       "role": "READER",
       "groupByEmail": "[GROUP_EMAIL]"
      }
     ],
     ...
    }
    

  3. When your edits are complete, use the update command and include the JSON file using the --source flag. If the dataset is in a project other than your default project, add the project ID to the dataset name in the following format: [PROJECT_ID]:[DATASET].

    bq update --source [PATH_TO_FILE] [PROJECT_ID]:[DATASET]
    

    Where:

    • [PATH_TO_FILE] is the path to the JSON file on your local machine.
    • [PROJECT_ID] is your project ID.
    • [DATASET] is the name of your dataset.

    Examples:

    Enter the following command to update the access controls for mydataset. mydataset is in your default project.

    bq update --source /tmp/mydataset.json mydataset
    

    Enter the following command to update the access controls for mydataset. mydataset is in myotherproject.

    bq update --source /tmp/mydataset.json myotherproject:mydataset
    
  4. To verify your access control changes, enter the show command again without writing the information to a file.

    bq show --format=prettyjson [DATASET]

    or

    bq show --format=prettyjson [PROJECT_ID]:[DATASET]

API

Call datasets.insert with a defined dataset resource to apply access controls when the dataset is created. Call datasets.patch and use the access property in the dataset resource to update your access controls.

Because the datasets.update method replaces the entire dataset resource, datasets.patch is the preferred method for updating access controls.

For more information, see Datasets.

Go

Set the dataset.access_entries property with the access controls for a dataset. Then call the client.update_dataset() function to update the property.

ds := client.Dataset(datasetID)
meta, err := ds.Metadata(ctx)
if err != nil {
	return err
}
// Append a new access control entry to the existing access list.
update := bigquery.DatasetMetadataToUpdate{
	Access: append(meta.Access, &bigquery.AccessEntry{
		Role:       bigquery.ReaderRole,
		EntityType: bigquery.UserEmailEntity,
		Entity:     "sample.bigquery.dev@gmail.com"},
	),
}

// Leverage the ETag for the update to assert there's been no modifications to the
// dataset since the metadata was originally read.
if _, err := ds.Update(ctx, update, meta.ETag); err != nil {
	return err
}

Python

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

# from google.cloud import bigquery
# client = bigquery.Client()
# dataset = client.get_dataset(client.dataset('my_dataset'))

entry = bigquery.AccessEntry(
    role='READER',
    entity_type='userByEmail',
    entity_id='sample.bigquery.dev@gmail.com')
assert entry not in dataset.access_entries
entries = list(dataset.access_entries)
entries.append(entry)
dataset.access_entries = entries

dataset = client.update_dataset(dataset, ['access_entries'])  # API request

assert entry in dataset.access_entries

Using datasets

Getting information about datasets

You can get dataset information using the BigQuery web UI, using the bq show CLI command or by calling the datasets.get API method.

Required permissions

To get information about a dataset, you must be assigned the dataset-level READER role, or you must be assigned a project-level IAM role that includes bigquery.datasets.get permissions. All predefined, project-level IAM roles include bigquery.datasets.get permissions except for bigquery.jobUser.

For more information on IAM roles and permissions in BigQuery, see Access Control. For more information on dataset-level roles, see Primitive roles for datasets.

Getting dataset information

To get information about datasets in a project:

Web UI

Click the dataset name. The Dataset Details page displays the dataset's description, details, and tables.

View dataset

Command-line

Issue the bq show command. The --format flag can be used to control the output. If you are getting information about a dataset in a project other than your default project, add the project ID to the dataset name in the following format: [PROJECT_ID]:[DATASET].

bq show --format=prettyjson [PROJECT_ID]:[DATASET]

Where:

  • [PROJECT_ID] is the name of your project.
  • [DATASET] is the name of the dataset.

Examples:

Enter the following command to display information about mydataset in your default project.

bq show --format=prettyjson mydataset

Enter the following command to display information about mydataset in myotherproject.

bq show --format=prettyjson myotherproject:mydataset

API

Call the datasets.get API method and provide any relevant parameters.

Go

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

meta, err := client.Dataset(datasetID).Metadata(ctx)
if err != nil {
	return err
}

fmt.Printf("Dataset ID: %s\n", datasetID)
fmt.Printf("Description: %s\n", meta.Description)
fmt.Println("Labels:")
for k, v := range meta.Labels {
	fmt.Printf("\t%s: %s", k, v)
}
fmt.Println("Tables:")
it := client.Dataset(datasetID).Tables(ctx)

cnt := 0
for {
	t, err := it.Next()
	if err == iterator.Done {
		break
	}
	cnt++
	fmt.Printf("\t%s\n", t.TableID)
}
if cnt == 0 {
	fmt.Println("\tThis dataset does not contain any tables.")
}

Java

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

DatasetId datasetId = DatasetId.of(projectId, datasetName);
Dataset dataset = bigquery.getDataset(datasetId);

Python

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

# from google.cloud import bigquery
# client = bigquery.Client()
# dataset_id = 'my_dataset'

dataset_ref = client.dataset(dataset_id)
dataset = client.get_dataset(dataset_ref)  # API request

# View dataset properties
print('Dataset ID: '.format(dataset_id))
print('Description: '.format(dataset.description))
print('Labels:')
for label, value in dataset.labels.items():
    print('\t{}: {}'.format(label, value))
# View tables in dataset
print('Tables:')
tables = list(client.list_tables(dataset_ref))  # API request(s)
if tables:
    for table in tables:
        print('\t{}'.format(table.table_id))
else:
    print('\tThis dataset does not contain any tables.')

Listing datasets

You can list datasets using the BigQuery web UI, using the bq ls CLI command or by calling the datasets.list API method.

Required permissions

When you list datasets, only datasets for which you have bigquery.datasets.get permissions are returned. This includes any dataset to which you have been granted dataset-level READER access. All predefined, project-level IAM roles include bigquery.datasets.get permissions except for bigquery.jobUser. If you are assigned a predefined, project-level IAM role other than bigquery.jobUser, you can list all the datasets in the project.

For more information on IAM roles and permissions in BigQuery, see Access Control. For more information on dataset-level roles, see Primitive roles for datasets.

Listing datasets in a project

To list the datasets in a project:

Web UI

Datasets are listed by project in the web UI's navigation pane.

Command-line

Issue the bq ls command to list datasets by dataset ID. The --format flag can be used to control the output. If you are listing dataset in a project other than your default project, add the --project_id flag to the command.

bq ls --format=prettyjson --project_id [PROJECT_ID]

Where:

  • [PROJECT_ID] is the name of your project.

Examples:

Enter the following command to list datasets in your default project.

bq ls --format=prettyjson

Enter the following command to list datasets in myotherproject.

bq ls --format=prettyjson --project_id myotherproject

API

To list datasets using the API, call the datasets.list API method.

C#

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

public List<BigQueryDataset> ListDatasets(BigQueryClient client)
{
    var datasets = client.ListDatasets().ToList();
    return datasets;
}

Go

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

it := client.Datasets(ctx)
for {
	dataset, err := it.Next()
	if err == iterator.Done {
		break
	}
	fmt.Println(dataset.DatasetID)
}

Java

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

// List datasets in the default project
Page<Dataset> datasets = bigquery.listDatasets(DatasetListOption.pageSize(100));
for (Dataset dataset : datasets.iterateAll()) {
  // do something with the dataset
}
// List datasets in a specified project
Page<Dataset> datasets = bigquery.listDatasets(projectId, DatasetListOption.pageSize(100));
for (Dataset dataset : datasets.iterateAll()) {
  // do something with the dataset
}

Node.js

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

// Imports the Google Cloud client library
const BigQuery = require('@google-cloud/bigquery');

/**
 * TODO(developer): Uncomment the following lines before running the sample.
 */
// const projectId = "your-project-id";

// Creates a client
const bigquery = new BigQuery({
  projectId: projectId,
});

// Lists all datasets in the specified project
bigquery
  .getDatasets()
  .then(results => {
    const datasets = results[0];
    console.log('Datasets:');
    datasets.forEach(dataset => console.log(dataset.id));
  })
  .catch(err => {
    console.error('ERROR:', err);
  });

PHP

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

use Google\Cloud\BigQuery\BigQueryClient;

/**
 * @param string $projectId The Google project ID.
 */
function list_datasets($projectId)
{
    $bigQuery = new BigQueryClient([
        'projectId' => $projectId,
    ]);
    $datasets = $bigQuery->datasets();
    foreach ($datasets as $dataset) {
        print($dataset->id() . PHP_EOL);
    }
}

Python

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

# from google.cloud import bigquery
# client = bigquery.Client()

datasets = list(client.list_datasets())
project = client.project

if datasets:
    print('Datasets in project {}:'.format(project))
    for dataset in datasets:  # API request(s)
        print('\t{}'.format(dataset.dataset_id))
else:
    print('{} project does not contain any datasets.'.format(project))

Ruby

For more on installing and creating a BigQuery client, refer to BigQuery Client Libraries.

# project_id = "Your Google Cloud project ID"

require "google/cloud/bigquery"

bigquery = Google::Cloud::Bigquery.new project: project_id

bigquery.datasets.each do |dataset|
  puts dataset.dataset_id
end

Getting dataset metadata using meta-tables

BigQuery offers some special tables whose contents represent metadata, such as the list of tables and views in a dataset. The "meta-tables" are read-only. To access metadata about the tables and views in a dataset, use the __TABLES_SUMMARY__ meta-table in a query's SELECT statement. You can run the query using the BigQuery web UI, using the command-line tool's bq query command, or by calling the jobs.insert API method and configuring a query job.

A query that uses the __TABLES_SUMMARY__ meta-table looks like the following:

    SELECT [FIELD] FROM [DATASET].__TABLES_SUMMARY__

Where:

  • DATASET is the name of your dataset
  • FIELD is one of the following:
Value Description
project_id Name of the project.
dataset_id Name of the dataset.
table_id Name of the table or view.
creation_time The time at which the table or view was created, in milliseconds since January 1, 1970 UTC.
type An integer representing the table type: a regular table (1) or a view (2).

Required permissions

To run a query job that uses the __TABLES_SUMMARY__ meta-table, you must have bigquery.jobs.create permissions. The following predefined, project-level IAM roles include bigquery.jobs.create permissions:

You must also be assigned the READER role at the dataset level, or you must be assigned a project-level IAM role that includes bigquery.tables.getData permissions. All predefined, project-level IAM roles except bigquery.user and bigquery.jobUser have bigquery.tables.getData permissions.

Meta-table limitations

Meta-tables are subject to the following limitations:

  • Generally, __TABLES_SUMMARY__ is reasonably fast for datasets with up to a few thousand tables. For larger datasets __TABLES_SUMMARY__ becomes increasingly slow, and may exceed available resources.
  • Meta-tables cannot be used with the tables.insert method.
  • Meta-tables cannot be used as a destination table.
  • Meta-tables do not support table decorators in legacy SQL.
  • Meta-tables do not appear when you list the tables in a dataset.

Meta-table examples

The following query retrieves all metadata for the bigquery-public-data.samples dataset.

Web UI

#standardSQL
SELECT
  *
FROM
  `bigquery-public-data.samples.__TABLES_SUMMARY__`

Command-line

bq --location=US query --use_legacy_sql=false '
SELECT
  *
FROM
  `bigquery-public-data.samples.__TABLES_SUMMARY__`'

The output looks like the following:

+----------------------+------------+-----------------+---------------+------+
| project_id           | dataset_id |    table_id     | creation_time | type |
+----------------------+------------+-----------------+---------------+------+
| bigquery-public-data | samples    | github_nested   | 1348782587310 |    1 |
| bigquery-public-data | samples    | github_timeline | 1335915950690 |    1 |
| bigquery-public-data | samples    | gsod            | 1335916040125 |    1 |
| bigquery-public-data | samples    | natality        | 1335916045005 |    1 |
| bigquery-public-data | samples    | shakespeare     | 1335916045099 |    1 |
| bigquery-public-data | samples    | trigrams        | 1335916127449 |    1 |
| bigquery-public-data | samples    | wikipedia       | 1335916132870 |    1 |
+----------------------+------------+-----------------+---------------+------+

The following query lists all tables and views in the bigquery-public-data.samples dataset.

Web UI

#standardSQL
SELECT
  table_id
FROM
  `bigquery-public-data.samples.__TABLES_SUMMARY__`

Command-line

bq --location=US query --use_legacy_sql=false '
SELECT
  table_id
FROM
  `bigquery-public-data.samples.__TABLES_SUMMARY__`'

The output looks like the following:

+-----------------+
|    table_id     |
+-----------------+
| github_nested   |
| github_timeline |
| gsod            |
| natality        |
| shakespeare     |
| trigrams        |
| wikipedia       |
+-----------------+

The following query lists the type for each table in the bigquery-public-data.samples dataset.

Web UI

#standardSQL
SELECT
  table_id, type
FROM
  `bigquery-public-data.samples.__TABLES_SUMMARY__`

Command-line

bq --location=US query --use_legacy_sql=false '
SELECT
  table_id, type
FROM
  `bigquery-public-data.samples.__TABLES_SUMMARY__`'

The output looks like the following:

+-----------------+------+
|    table_id     | type |
+-----------------+------+
| github_nested   |   1  |
| github_timeline |   1  |
| gsod            |   1  |
| natality        |   1  |
| shakespeare     |   1  |
| trigrams        |   1  |
| wikipedia       |   1  |
+-----------------+------+

Next steps

Was this page helpful? Let us know how we did:

Send feedback about...