Пример #1
0
def sample_lookup_entry(sql_name):
    """
    Lookup Entry using SQL resource

    Args:
      sql_name The SQL name of the Google Cloud Platform resource the Data Catalog
      entry represents.
      Examples:
      bigquery.table.`bigquery-public-data`.new_york_taxi_trips.taxi_zone_geom
      pubsub.topic.`pubsub-public-data`.`taxirides-realtime`
    """

    client = datacatalog_v1beta1.DataCatalogClient()

    # sql_name = '[SQL Resource Name]'
    response = client.lookup_entry(sql_resource=sql_name)
    entry = response
    print(u"Entry name: {}".format(entry.name))
    print(u"Entry type: {}".format(enums.EntryType(entry.type).name))
    print(u"Linked resource: {}".format(entry.linked_resource))
Пример #2
0
def sample_lookup_entry(resource_name):
    """
    Lookup Entry

    Args:
      resource_name The full name of the Google Cloud Platform resource the Data
      Catalog entry represents.
      See: https://cloud.google.com/apis/design/resource_names#full_resource_name
      Examples:
      //bigquery.googleapis.com/projects/bigquery-public-data/datasets/new_york_taxi_trips/tables/taxi_zone_geom
      //pubsub.googleapis.com/projects/pubsub-public-data/topics/taxirides-realtime
    """

    client = datacatalog_v1beta1.DataCatalogClient()

    # resource_name = '[Full Resource Name]'
    response = client.lookup_entry(linked_resource=resource_name)
    entry = response
    print(u"Entry name: {}".format(entry.name))
    print(u"Entry type: {}".format(enums.EntryType(entry.type).name))
    print(u"Linked resource: {}".format(entry.linked_resource))
Пример #3
0
def sample_get_entry(project_id, location_id, entry_group_id, entry_id):
    """
    Get Entry

    Args:
      project_id Your Google Cloud project ID
      location_id Google Cloud region, e.g. us-central1
      entry_group_id ID of the Entry Group, e.g. @bigquery, @pubsub, my_entry_group
      entry_id ID of the Entry
    """

    client = datacatalog_v1beta1.DataCatalogClient()

    # project_id = '[Google Cloud Project ID]'
    # location_id = '[Google Cloud Location ID]'
    # entry_group_id = '[Entry Group ID]'
    # entry_id = '[Entry ID]'
    name = client.entry_path(project_id, location_id, entry_group_id, entry_id)

    response = client.get_entry(name)
    entry = response
    print(u"Entry name: {}".format(entry.name))
    print(u"Entry type: {}".format(enums.EntryType(entry.type).name))
    print(u"Linked resource: {}".format(entry.linked_resource))