diff --git a/appengine/standard_python3/bigquery/requirements.txt b/appengine/standard_python3/bigquery/requirements.txt index 00a431743a1c..e57af0c235d3 100644 --- a/appengine/standard_python3/bigquery/requirements.txt +++ b/appengine/standard_python3/bigquery/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-bigquery==1.28.0 +google-cloud-bigquery==2.0.0 Flask==1.1.2 diff --git a/bigquery/bqml/data_scientist_tutorial_test.py b/bigquery/bqml/data_scientist_tutorial_test.py index f5fec0a9497f..1f0b2ad9d24f 100644 --- a/bigquery/bqml/data_scientist_tutorial_test.py +++ b/bigquery/bqml/data_scientist_tutorial_test.py @@ -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] diff --git a/bigquery/bqml/ncaa_tutorial_test.py b/bigquery/bqml/ncaa_tutorial_test.py index 488684d86660..9d588b7640ed 100644 --- a/bigquery/bqml/ncaa_tutorial_test.py +++ b/bigquery/bqml/ncaa_tutorial_test.py @@ -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] diff --git a/bigquery/bqml/requirements-test.txt b/bigquery/bqml/requirements-test.txt index 7e460c8c866e..ffd98cdb992d 100644 --- a/bigquery/bqml/requirements-test.txt +++ b/bigquery/bqml/requirements-test.txt @@ -1 +1,3 @@ +flaky==3.7.0 +mock==4.0.2 pytest==6.0.1 diff --git a/bigquery/bqml/requirements.txt b/bigquery/bqml/requirements.txt index 45435eab259d..e4766f477e52 100644 --- a/bigquery/bqml/requirements.txt +++ b/bigquery/bqml/requirements.txt @@ -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 diff --git a/bigquery/datalab-migration/requirements.txt b/bigquery/datalab-migration/requirements.txt index 2aec78b4131b..261259513a61 100644 --- a/bigquery/datalab-migration/requirements.txt +++ b/bigquery/datalab-migration/requirements.txt @@ -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 diff --git a/bigquery/pandas-gbq-migration/requirements.txt b/bigquery/pandas-gbq-migration/requirements.txt index 0047df7bbc7c..06bc317519cd 100644 --- a/bigquery/pandas-gbq-migration/requirements.txt +++ b/bigquery/pandas-gbq-migration/requirements.txt @@ -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 diff --git a/bigquery/pandas-gbq-migration/samples_test.py b/bigquery/pandas-gbq-migration/samples_test.py index 670ef46f0013..89568526f87e 100644 --- a/bigquery/pandas-gbq-migration/samples_test.py +++ b/bigquery/pandas-gbq-migration/samples_test.py @@ -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 diff --git a/data-science-onramp/data-cleaning/requirements-test.txt b/data-science-onramp/data-cleaning/requirements-test.txt index 91141c304d78..80d4ddbcb758 100644 --- a/data-science-onramp/data-cleaning/requirements-test.txt +++ b/data-science-onramp/data-cleaning/requirements-test.txt @@ -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 diff --git a/data-science-onramp/data-ingestion/requirements.txt b/data-science-onramp/data-ingestion/requirements.txt index c37077cb99a7..473ba9135307 100644 --- a/data-science-onramp/data-ingestion/requirements.txt +++ b/data-science-onramp/data-ingestion/requirements.txt @@ -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 diff --git a/notebooks/requirements.txt b/notebooks/requirements.txt index 94e386b2d9d2..8a280a8cca2e 100644 --- a/notebooks/requirements.txt +++ b/notebooks/requirements.txt @@ -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' \ No newline at end of file