From 2da870e51f403a35fbe1e23d701de66389e48f42 Mon Sep 17 00:00:00 2001 From: sangramql <39852271+sangramql@users.noreply.github.com> Date: Fri, 9 Aug 2019 01:26:56 +0530 Subject: [PATCH 1/4] Avoid creating table in 'list_tables' snippet; harden 'delete_instance' snippet. (#8879) Closes #8479. --- bigtable/docs/snippets.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/bigtable/docs/snippets.py b/bigtable/docs/snippets.py index 1119b3b6bd90..850362b4a42a 100644 --- a/bigtable/docs/snippets.py +++ b/bigtable/docs/snippets.py @@ -36,6 +36,7 @@ from test_utils.retry import RetryErrors from google.api_core.exceptions import NotFound from google.api_core.exceptions import TooManyRequests +from google.api_core.exceptions import DeadlineExceeded from google.cloud._helpers import UTC from google.cloud.bigtable import Client from google.cloud.bigtable import enums @@ -45,6 +46,7 @@ INSTANCE_ID = "snippet-tests" + UNIQUE_SUFFIX CLUSTER_ID = "clus-1-" + UNIQUE_SUFFIX APP_PROFILE_ID = "app-prof" + UNIQUE_SUFFIX +TABLE_ID = "tabl-1" + UNIQUE_SUFFIX ROUTING_POLICY_TYPE = enums.RoutingPolicyType.ANY LOCATION_ID = "us-central1-f" ALT_LOCATION_ID = "us-central1-a" @@ -61,6 +63,7 @@ INSTANCES_TO_DELETE = [] retry_429 = RetryErrors(TooManyRequests, max_tries=9) +retry_504 = RetryErrors(DeadlineExceeded, max_tries=4) class Config(object): @@ -72,6 +75,7 @@ class Config(object): CLIENT = None INSTANCE = None + TABLE = None def setup_module(): @@ -88,6 +92,8 @@ def setup_module(): operation = Config.INSTANCE.create(clusters=[cluster]) # We want to make sure the operation completes. operation.result(timeout=100) + Config.TABLE = Config.INSTANCE.table(TABLE_ID) + retry_504(Config.TABLE.create)() def teardown_module(): @@ -421,14 +427,6 @@ def test_bigtable_create_table(): def test_bigtable_list_tables(): - from google.cloud.bigtable import Client - from google.cloud.bigtable import column_family - - client = Client(admin=True) - instance = client.instance(INSTANCE_ID) - table = instance.table("to_list") - max_versions_rule = column_family.MaxVersionsGCRule(2) - table.create(column_families={"cf1": max_versions_rule}) # [START bigtable_list_tables] from google.cloud.bigtable import Client @@ -438,11 +436,9 @@ def test_bigtable_list_tables(): tables_list = instance.list_tables() # [END bigtable_list_tables] + # Check if returned list has expected table table_names = [table.name for table in tables_list] - try: - assert table.name in table_names - finally: - retry_429(table.delete)() + assert Config.TABLE.name in table_names def test_bigtable_delete_cluster(): @@ -479,9 +475,10 @@ def test_bigtable_delete_instance(): client = Client(admin=True) - instance = client.instance("inst-my-123", instance_type=PRODUCTION, labels=LABELS) + instance_id = "snipt-inst-del" + UNIQUE_SUFFIX + instance = client.instance(instance_id, instance_type=PRODUCTION, labels=LABELS) cluster = instance.cluster( - "clus-my-123", + "clus-to-delete" + UNIQUE_SUFFIX, location_id=ALT_LOCATION_ID, serve_nodes=1, default_storage_type=STORAGE_TYPE, @@ -499,7 +496,6 @@ def test_bigtable_delete_instance(): client = Client(admin=True) - instance_id = "inst-my-123" instance_to_delete = client.instance(instance_id) instance_to_delete.delete() # [END bigtable_delete_instance] From adccba0908aa0a7b233d55510b3f3dfed2fe4219 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Thu, 8 Aug 2019 16:04:23 -0400 Subject: [PATCH 2/4] Normalize docs. (#8994) * Make 'containeranalysis/docs/README.rst' a symlink. * DRY 'phishinprotection/docs/index.rst', include changelog. * Update 'monitoring/README.rst' to use googleapis.dev URL. See #8993. --- containeranalysis/README.rst | 4 +- containeranalysis/docs/README.rst | 77 +------------------------ monitoring/README.rst | 2 +- phishingprotection/docs/README.rst | 1 + phishingprotection/docs/changelog.md | 1 + phishingprotection/docs/index.rst | 85 ++++------------------------ 6 files changed, 17 insertions(+), 153 deletions(-) mode change 100644 => 120000 containeranalysis/docs/README.rst create mode 120000 phishingprotection/docs/README.rst create mode 120000 phishingprotection/docs/changelog.md diff --git a/containeranalysis/README.rst b/containeranalysis/README.rst index 0910115bec99..4a59b581c499 100644 --- a/containeranalysis/README.rst +++ b/containeranalysis/README.rst @@ -9,7 +9,7 @@ and retrieval of critical metadata about all of your software artifacts. .. _Alpha: https://github.com/googleapis/google-cloud-python/blob/master/README.rst .. _Container Analysis API: https://cloud.google.com/container-registry/docs/container-analysis -.. _Client Library Documentation: https://googleapis.dev/python/containeranalysis/latest/index.html +.. _Client Library Documentation: https://googleapis.dev/python/containeranalysis/latest .. _Product Documentation: https://cloud.google.com/container-registry/docs/container-analysis Quick Start @@ -73,4 +73,4 @@ Next Steps APIs that we cover. .. _Container Analysis API Product documentation: https://cloud.google.com/container-registry/docs/container-analysis -.. _repository’s main README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst \ No newline at end of file +.. _repository’s main README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst diff --git a/containeranalysis/docs/README.rst b/containeranalysis/docs/README.rst deleted file mode 100644 index e2d7a200e4e8..000000000000 --- a/containeranalysis/docs/README.rst +++ /dev/null @@ -1,76 +0,0 @@ -Python Client for Container Analysis API (`Alpha`_) -=================================================== - -`Container Analysis API`_: An implementation of the Grafeas API, which stores, and enables querying -and retrieval of critical metadata about all of your software artifacts. - -- `Client Library Documentation`_ -- `Product Documentation`_ - -.. _Alpha: https://github.com/googleapis/google-cloud-python/blob/master/README.rst -.. _Container Analysis API: https://cloud.google.com/container-registry/docs/container-analysis -.. _Client Library Documentation: https://googleapis.dev/python/containeranalysis/latest -.. _Product Documentation: https://cloud.google.com/container-registry/docs/container-analysis - -Quick Start ------------ - -In order to use this library, you first need to go through the following steps: - -1. `Select or create a Cloud Platform project.`_ -2. `Enable billing for your project.`_ -3. `Enable the Container Analysis API.`_ -4. `Setup Authentication.`_ - -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Enable the Container Analysis API.: https://cloud.google.com/container-registry/docs/container-analysis -.. _Setup Authentication.: https://googleapis.dev/python/containeranalysis/latest - -Installation -~~~~~~~~~~~~ - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -^^^^^^^^^ - -.. code-block:: console - - pip install virtualenv - virtualenv - source /bin/activate - /bin/pip install google-cloud-containeranalysis - - -Windows -^^^^^^^ - -.. code-block:: console - - pip install virtualenv - virtualenv - \Scripts\activate - \Scripts\pip.exe install google-cloud-containeranalysis - -Next Steps -~~~~~~~~~~ - -- Read the `Client Library Documentation`_ for Container Analysis API - API to see other available methods on the client. -- Read the `Container Analysis API Product documentation`_ to learn - more about the product and see How-to Guides. -- View this `repository’s main README`_ to see the full list of Cloud - APIs that we cover. - -.. _Container Analysis API Product documentation: https://cloud.google.com/container-registry/docs/container-analysis -.. _repository’s main README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst \ No newline at end of file diff --git a/containeranalysis/docs/README.rst b/containeranalysis/docs/README.rst new file mode 120000 index 000000000000..89a0106941ff --- /dev/null +++ b/containeranalysis/docs/README.rst @@ -0,0 +1 @@ +../README.rst \ No newline at end of file diff --git a/monitoring/README.rst b/monitoring/README.rst index 974d7aa761a9..6edba219c376 100644 --- a/monitoring/README.rst +++ b/monitoring/README.rst @@ -20,7 +20,7 @@ with a few exceptions as noted on the individual method pages. .. |compat_check_github| image:: https://python-compatibility-tools.appspot.com/one_badge_image?package=git%2Bgit%3A//github.com/googleapis/google-cloud-python.git%23subdirectory%3Dmonitoring :target: https://python-compatibility-tools.appspot.com/one_badge_target?package=git%2Bgit%3A//github.com/googleapis/google-cloud-python.git%23subdirectory%3Dmonitoring .. _Stackdriver Monitoring API: https://cloud.google.com/monitoring/api/ref_v3/rest/ -.. _Client Library Documentation: https://google-cloud-python.readthedocs.io/en/latest/monitoring/ +.. _Client Library Documentation: https://googleapis.dev/python/monitoring/latest .. _Product Documentation: https://cloud.google.com/monitoring/docs Quick Start diff --git a/phishingprotection/docs/README.rst b/phishingprotection/docs/README.rst new file mode 120000 index 000000000000..89a0106941ff --- /dev/null +++ b/phishingprotection/docs/README.rst @@ -0,0 +1 @@ +../README.rst \ No newline at end of file diff --git a/phishingprotection/docs/changelog.md b/phishingprotection/docs/changelog.md new file mode 120000 index 000000000000..04c99a55caae --- /dev/null +++ b/phishingprotection/docs/changelog.md @@ -0,0 +1 @@ +../CHANGELOG.md \ No newline at end of file diff --git a/phishingprotection/docs/index.rst b/phishingprotection/docs/index.rst index b751edabdfba..e2a1a304cac3 100644 --- a/phishingprotection/docs/index.rst +++ b/phishingprotection/docs/index.rst @@ -1,83 +1,20 @@ -Python Client for Phishing Protection API (`Alpha`_) -==================================================== +.. include:: README.rst -`Phishing Protection API`_: - -- `Client Library Documentation`_ -- `Product Documentation`_ - -.. _Alpha: https://github.com/googleapis/google-cloud-python/blob/master/README.rst -.. _Phishing Protection API: https://cloud.google.com/phishingprotection -.. _Client Library Documentation: https://googleapis.dev/python/phishingprotection/latest -.. _Product Documentation: https://cloud.google.com/phishingprotection - -Quick Start ------------ - -In order to use this library, you first need to go through the following steps: - -1. `Select or create a Cloud Platform project.`_ -2. `Enable billing for your project.`_ -3. `Enable the Phishing Protection API.`_ -4. `Setup Authentication.`_ - -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Enable the Phishing Protection API.: https://cloud.google.com/phishingprotection -.. _Setup Authentication.: https://googleapis.dev/python/phishingprotection/latest - -Installation -~~~~~~~~~~~~ - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -^^^^^^^^^ - -.. code-block:: console - - pip install virtualenv - virtualenv - source /bin/activate - /bin/pip install google-cloud-phishingprotection - - -Windows -^^^^^^^ - -.. code-block:: console +Api Reference +------------- +.. toctree:: + :maxdepth: 2 - pip install virtualenv - virtualenv - \Scripts\activate - \Scripts\pip.exe install google-cloud-phishingprotection + gapic/v1beta1/api + gapic/v1beta1/types -Next Steps -~~~~~~~~~~ -- Read the `Client Library Documentation`_ for Phishing Protection API - API to see other available methods on the client. -- Read the `Phishing Protection API Product documentation`_ to learn - more about the product and see How-to Guides. -- View this `repository’s main README`_ to see the full list of Cloud - APIs that we cover. +Changelog +---------- -.. _Phishing Protection API Product documentation: https://cloud.google.com/phishingprotection -.. _repository’s main README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst +For all previous ``google-cloud-phishingprotection`` releases: -Api Reference -------------- .. toctree:: :maxdepth: 2 - gapic/v1beta1/api - gapic/v1beta1/types \ No newline at end of file + changelog From 6d049206e8a5e0a57ae9b93cbf08f5a349f7d9c4 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Thu, 8 Aug 2019 16:27:31 -0400 Subject: [PATCH 3/4] Harden 'test_access_to_public_bucket' systest against 429 / 503 errors. (#8997) Closes #8996. --- storage/tests/system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/tests/system.py b/storage/tests/system.py index 1a63409fdd24..c2717fb2b1af 100644 --- a/storage/tests/system.py +++ b/storage/tests/system.py @@ -1335,9 +1335,9 @@ class TestAnonymousClient(unittest.TestCase): def test_access_to_public_bucket(self): anonymous = storage.Client.create_anonymous_client() bucket = anonymous.bucket(self.PUBLIC_BUCKET) - blob, = bucket.list_blobs(max_results=1) + blob, = retry_429_503(bucket.list_blobs)(max_results=1) with tempfile.TemporaryFile() as stream: - blob.download_to_file(stream) + retry_429_503(blob.download_to_file)(stream) class TestKMSIntegration(TestStorageFiles): From 5c9bb42cb3c9250131cfeef6e0bafe8f4b7c139f Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Thu, 8 Aug 2019 13:53:21 -0700 Subject: [PATCH 4/4] Release bigquery 1.18.0 (#8995) --- bigquery/CHANGELOG.md | 32 ++++++++++++++++++++++++++++++++ bigquery/setup.py | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/bigquery/CHANGELOG.md b/bigquery/CHANGELOG.md index 0d6630ef3bba..6d1c71ccbf79 100644 --- a/bigquery/CHANGELOG.md +++ b/bigquery/CHANGELOG.md @@ -4,6 +4,38 @@ [1]: https://pypi.org/project/google-cloud-bigquery/#history +## 1.18.0 + +08-08-2019 12:28 PDT + +### New Features + +- Add `bqstorage_client` param to `QueryJob.to_arrow()` ([#8693](https://github.com/googleapis/google-cloud-python/pull/8693)) +- Include SQL query and job ID in exception messages. ([#8748](https://github.com/googleapis/google-cloud-python/pull/8748)) +- Allow using TableListItem to construct a Table object. ([#8738](https://github.com/googleapis/google-cloud-python/pull/8738)) +- Add StandardSqlDataTypes enum to BigQuery ([#8782](https://github.com/googleapis/google-cloud-python/pull/8782)) +- Add `to_standard_sql()` method to SchemaField ([#8880](https://github.com/googleapis/google-cloud-python/pull/8880)) +- Add debug logging statements to track when BQ Storage API is used. ([#8838](https://github.com/googleapis/google-cloud-python/pull/8838)) +- Hide error traceback in BigQuery cell magic ([#8808](https://github.com/googleapis/google-cloud-python/pull/8808)) +- Allow choice of compression when loading from dataframe ([#8938](https://github.com/googleapis/google-cloud-python/pull/8938)) +- Additional clustering metrics for BQML K-means models (via synth). ([#8945](https://github.com/googleapis/google-cloud-python/pull/8945)) + +### Documentation + +- Add compatibility check badges to READMEs. ([#8288](https://github.com/googleapis/google-cloud-python/pull/8288)) +- Link to googleapis.dev documentation in READMEs. ([#8705](https://github.com/googleapis/google-cloud-python/pull/8705)) +- Remove redundant service account key code sample. ([#8891](https://github.com/googleapis/google-cloud-python/pull/8891)) + +### Internal / Testing Changes + +- Fix several pytest "skip if" markers ([#8694](https://github.com/googleapis/google-cloud-python/pull/8694)) +- Update tests to support conversion of NaN as NULL in pyarrow `0.14.*`. ([#8785](https://github.com/googleapis/google-cloud-python/pull/8785)) +- Mock external calls in one of BigQuery unit tests ([#8727](https://github.com/googleapis/google-cloud-python/pull/8727)) +- Set IPython user agent when running queries with IPython cell magic ([#8713](https://github.com/googleapis/google-cloud-python/pull/8713)) +- Use configurable bucket name for GCS samples data in systems tests. ([#8783](https://github.com/googleapis/google-cloud-python/pull/8783)) +- Move `maybe_fail_import()` to top level test utils ([#8840](https://github.com/googleapis/google-cloud-python/pull/8840)) +- Set BQ Storage client user-agent when in Jupyter cell ([#8734](https://github.com/googleapis/google-cloud-python/pull/8734)) + ## 1.17.0 07-12-2019 07:56 PDT diff --git a/bigquery/setup.py b/bigquery/setup.py index a05c18053379..337a974ac485 100644 --- a/bigquery/setup.py +++ b/bigquery/setup.py @@ -22,7 +22,7 @@ name = "google-cloud-bigquery" description = "Google BigQuery API client library" -version = "1.17.0" +version = "1.18.0" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta'