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.

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("The dataset resource name: {}\n".format(response.name))
    print("Display name: {}".format(response.display_name))
    print("Description: {}".format(response.description))
    print("Create time:")
    print("\tseconds: {}".format(response.create_time.timestamp_pb().seconds))
    print("\tnanos: {}".format(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