Get a dataset (beta)

Get a dataset from a given Google Cloud project.

Code sample

Python

To learn how to install and use the client library for Data Labeling Service, see Data Labeling Service client libraries. For more information, see the Data Labeling Service Python API reference documentation.

To authenticate to Data Labeling Service, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

def get_dataset(dataset_resource_name):
    """Gets a dataset for the given Google Cloud project."""
    from google.cloud import datalabeling_v1beta1 as datalabeling

    client = datalabeling.DataLabelingServiceClient()

    response = client.get_dataset(request={"name": dataset_resource_name})

    print(f"The dataset resource name: {response.name}\n")
    print(f"Display name: {response.display_name}")
    print(f"Description: {response.description}")
    print("Create time:")
    print(f"\tseconds: {response.create_time.timestamp_pb().seconds}")
    print(f"\tnanos: {response.create_time.timestamp_pb().nanos}")

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.