Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Data Catalog samples to V1 #3382

Merged
merged 4 commits into from
Apr 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions datacatalog/cloud-client/lookup_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
def lookup_bigquery_dataset(project_id, dataset_id):
# [START datacatalog_lookup_dataset]
"""Retrieves Data Catalog entry for the given BigQuery Dataset."""
from google.cloud import datacatalog_v1beta1
from google.cloud import datacatalog_v1

datacatalog = datacatalog_v1beta1.DataCatalogClient()
datacatalog = datacatalog_v1.DataCatalogClient()

resource_name = '//bigquery.googleapis.com/projects/{}/datasets/{}'\
.format(project_id, dataset_id)
Expand All @@ -42,9 +42,9 @@ def lookup_bigquery_dataset_sql_resource(project_id, dataset_id):
"""Retrieves Data Catalog entry for the given BigQuery Dataset by
sql_resource.
"""
from google.cloud import datacatalog_v1beta1
from google.cloud import datacatalog_v1

datacatalog = datacatalog_v1beta1.DataCatalogClient()
datacatalog = datacatalog_v1.DataCatalogClient()

sql_resource = 'bigquery.dataset.`{}`.`{}`'.format(project_id, dataset_id)

Expand All @@ -53,9 +53,9 @@ def lookup_bigquery_dataset_sql_resource(project_id, dataset_id):

def lookup_bigquery_table(project_id, dataset_id, table_id):
"""Retrieves Data Catalog entry for the given BigQuery Table."""
from google.cloud import datacatalog_v1beta1
from google.cloud import datacatalog_v1

datacatalog = datacatalog_v1beta1.DataCatalogClient()
datacatalog = datacatalog_v1.DataCatalogClient()

resource_name = '//bigquery.googleapis.com/projects/{}/datasets/{}' \
'/tables/{}'\
Expand All @@ -68,9 +68,9 @@ def lookup_bigquery_table_sql_resource(project_id, dataset_id, table_id):
"""Retrieves Data Catalog entry for the given BigQuery Table by
sql_resource.
"""
from google.cloud import datacatalog_v1beta1
from google.cloud import datacatalog_v1

datacatalog = datacatalog_v1beta1.DataCatalogClient()
datacatalog = datacatalog_v1.DataCatalogClient()

sql_resource = 'bigquery.table.`{}`.`{}`.`{}`'.format(
project_id, dataset_id, table_id)
Expand All @@ -80,9 +80,9 @@ def lookup_bigquery_table_sql_resource(project_id, dataset_id, table_id):

def lookup_pubsub_topic(project_id, topic_id):
"""Retrieves Data Catalog entry for the given Pub/Sub Topic."""
from google.cloud import datacatalog_v1beta1
from google.cloud import datacatalog_v1

datacatalog = datacatalog_v1beta1.DataCatalogClient()
datacatalog = datacatalog_v1.DataCatalogClient()

resource_name = '//pubsub.googleapis.com/projects/{}/topics/{}'\
.format(project_id, topic_id)
Expand All @@ -94,9 +94,9 @@ def lookup_pubsub_topic_sql_resource(project_id, topic_id):
"""Retrieves Data Catalog entry for the given Pub/Sub Topic by
sql_resource.
"""
from google.cloud import datacatalog_v1beta1
from google.cloud import datacatalog_v1

datacatalog = datacatalog_v1beta1.DataCatalogClient()
datacatalog = datacatalog_v1.DataCatalogClient()

sql_resource = 'pubsub.topic.`{}`.`{}`'.format(project_id, topic_id)

Expand Down