Skip to content

Commit

Permalink
chore(deps): update dependency google-cloud-bigquery to v2 (#4781)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency google-cloud-bigquery to v2

* update bigquery/bqml tutorials

* update datalab tutorial

* update pandas-gbq-migration samples

Co-authored-by: Tim Swast <swast@google.com>
  • Loading branch information
renovate-bot and tswast authored Oct 8, 2020
1 parent 8907fe1 commit 48f5ef9
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 32 deletions.
2 changes: 1 addition & 1 deletion appengine/standard_python3/bigquery/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-bigquery==1.28.0
google-cloud-bigquery==2.0.0
Flask==1.1.2
6 changes: 3 additions & 3 deletions bigquery/bqml/data_scientist_tutorial_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
# other invocations of this tutorial. In practice, you could leverage
# a persistent dataset and not create/destroy it with each invocation.
dataset_id = "bqml_tutorial_{}".format(str(uuid.uuid4().hex))
full_dataset_id = "{}.{}".format(client.project, dataset_id)
# [END bqml_data_scientist_tutorial_import_and_client]


@pytest.fixture
def delete_dataset():
yield
client.delete_dataset(
client.dataset(dataset_id), delete_contents=True)
client.delete_dataset(full_dataset_id, delete_contents=True)


def test_data_scientist_tutorial(delete_dataset):
# [START bqml_data_scientist_tutorial_create_dataset]
dataset = bigquery.Dataset(client.dataset(dataset_id))
dataset = bigquery.Dataset(full_dataset_id)
dataset.location = 'US'
client.create_dataset(dataset)
# [END bqml_data_scientist_tutorial_create_dataset]
Expand Down
7 changes: 4 additions & 3 deletions bigquery/bqml/ncaa_tutorial_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@
# other invocations of this tutorial. In practice, you could leverage
# a persistent dataset and not create/destroy it with each invocation.
dataset_id = "bqml_tutorial_{}".format(str(uuid.uuid4().hex))
full_dataset_id = "{}.{}".format(client.project, dataset_id)
# [END bqml_ncaa_tutorial_import_and_client]


@pytest.fixture
def delete_dataset():

yield
client.delete_dataset(
client.dataset(dataset_id), delete_contents=True)
client.delete_dataset(full_dataset_id, delete_contents=True)


def test_ncaa_tutorial(delete_dataset):
# [START bqml_ncaa_tutorial_create_dataset]
dataset = bigquery.Dataset(client.dataset(dataset_id))
dataset = bigquery.Dataset(full_dataset_id)
dataset.location = 'US'
client.create_dataset(dataset)
# [END bqml_ncaa_tutorial_create_dataset]
Expand Down
2 changes: 2 additions & 0 deletions bigquery/bqml/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
flaky==3.7.0
mock==4.0.2
pytest==6.0.1
4 changes: 3 additions & 1 deletion bigquery/bqml/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
google-cloud-bigquery[pandas,bqstorage]==2.0.0
google-cloud-bigquery-storage==2.0.0
pandas==1.1.3
google-cloud-bigquery==1.28.0
pyarrow==1.0.1
flaky==3.7.0
mock==4.0.2
8 changes: 3 additions & 5 deletions bigquery/datalab-migration/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
grpcio==1.32.0
google-cloud-bigquery[pandas,pyarrow]==1.28.0
google-cloud-bigquery-storage==1.1.0
google-cloud-bigquery[pandas,pyarrow]==2.0.0
google-cloud-bigquery-storage==2.0.0
datalab==1.2.0
ipython==7.13.0; python_version > "2.7"
ipython<=5.5; python_version == "2.7"
google-cloud-monitoring==1.1.0
ipython==7.13.0
pyarrow==1.0.1
7 changes: 3 additions & 4 deletions bigquery/pandas-gbq-migration/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
google-cloud-bigquery==1.28.0
google-cloud-bigquery-storage==1.1.0
pandas==0.25.3; python_version > '3.0'
pandas==0.24.2; python_version < '3.0'
google-cloud-bigquery==2.0.0
google-cloud-bigquery-storage==2.0.0
pandas==1.1.3
pandas-gbq==0.14.0
pyarrow==1.0.1
grpcio==1.32.0
14 changes: 2 additions & 12 deletions bigquery/pandas-gbq-migration/samples_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,13 @@ def test_pandas_gbq_query():

def test_client_library_query_bqstorage():
# [START bigquery_migration_client_library_query_bqstorage]
import google.auth
from google.cloud import bigquery
from google.cloud import bigquery_storage_v1beta1

# Create a BigQuery client and a BigQuery Storage API client with the same
# credentials to avoid authenticating twice.
credentials, project_id = google.auth.default(
scopes=["https://www.googleapis.com/auth/cloud-platform"]
)
client = bigquery.Client(credentials=credentials, project=project_id)
bqstorage_client = bigquery_storage_v1beta1.BigQueryStorageClient(
credentials=credentials
)
client = bigquery.Client()
sql = "SELECT * FROM `bigquery-public-data.irs_990.irs_990_2012`"

# Use a BigQuery Storage API client to download results more quickly.
df = client.query(sql).to_dataframe(bqstorage_client=bqstorage_client)
df = client.query(sql).to_dataframe(create_bqstorage_client=True)
# [END bigquery_migration_client_library_query_bqstorage]
assert len(df) > 0

Expand Down
2 changes: 1 addition & 1 deletion data-science-onramp/data-cleaning/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest==6.0.1
pandas==1.1.3
google-cloud-bigquery==1.28.0
google-cloud-bigquery==2.0.0
pyarrow==1.0.1
2 changes: 1 addition & 1 deletion data-science-onramp/data-ingestion/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
#google-auth-httplib2==0.0.3
google-cloud-storage==1.31.2
google-cloud-dataproc==2.0.2
google-cloud-bigquery==1.28.0
google-cloud-bigquery==2.0.0
2 changes: 1 addition & 1 deletion notebooks/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
google-cloud-storage==1.31.2
google-cloud-bigquery[pandas,pyarrow]==1.28.0
google-cloud-bigquery[pandas,pyarrow]==2.0.0
matplotlib==3.1.2; python_version > '3.0'
matplotlib==2.2.5; python_version < '3.0'

0 comments on commit 48f5ef9

Please sign in to comment.