Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit 571171e

Browse files
tswastgcf-owl-bot[bot]parthea
authored
docs: convert UPGRADING guide to RST to fix table formatting (#268)
* docs: convert UPGRADING guide to RST to fix table formatting * use latest post processor image * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 634fed7 commit 571171e

File tree

6 files changed

+204
-179
lines changed

6 files changed

+204
-179
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
docker:
22
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
3-
digest: sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7
3+
digest: sha256:74124fe59b8859f30143dcdea7b78300046d97de816dc53c0e381308a5f4f8bc

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196

197197
### ⚠ BREAKING CHANGES
198198

199-
* This release has breaking changes. See the [2.0.0 Migration Guide](https://github.com/googleapis/python-datacatalog/blob/main/UPGRADING.md) for details.
199+
* This release has breaking changes. See the [2.0.0 Migration Guide](https://github.com/googleapis/python-datacatalog/blob/main/UPGRADING.rst) for details.
200200

201201
### Features
202202

UPGRADING.md

Lines changed: 0 additions & 176 deletions
This file was deleted.

UPGRADING.rst

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
3.0.0 Migration Guide
2+
=====================
3+
4+
This document describes the breaking changes that have been made, and what you need to do to update your usage.
5+
6+
The most significant change was introduced at v2.0 release based on a `next-gen code generator <https://github.com/googleapis/gapic-generator-python>`_, and includes substantial interface changes. Existing code written for eariler versions of this library will likely require updates to use this version.
7+
8+
If you experience issues or have questions, please file an `issue <https://github.com/googleapis/python-datacatalog/issues>`_.
9+
10+
Supported Python Versions
11+
-------------------------
12+
13+
+------------------------------+
14+
| Applicable previous versions |
15+
+==============================+
16+
| v1.0.0 or lower |
17+
+------------------------------+
18+
19+
.. warning:
20+
21+
**Breaking change:**
22+
The 2.0.0 release requires Python 3.6+.
23+
24+
25+
Method Calls
26+
------------
27+
28+
+------------------------------+
29+
| Applicable previous versions |
30+
+==============================+
31+
| v1.0.0 or lower |
32+
+------------------------------+
33+
34+
.. warning:
35+
36+
**Breaking change:**
37+
Methods expect request objects. We provide a script that will convert most common use cases.
38+
39+
* Install the library
40+
41+
.. code-block:: shell
42+
43+
python3 -m pip install google-cloud-datacatalog
44+
45+
* The script `fixup_datacatalog_v1_keywords.py` is shipped with the library. It expects
46+
an input directory (with the code to convert) and an empty destination directory.
47+
48+
.. code-block:: shell
49+
50+
fixup_datacatalog_v1_keywords.py --input-directory .samples/ --output-directory samples/
51+
52+
**Before:**
53+
54+
.. code-block:: python
55+
56+
from google.cloud import datacatalog_v1
57+
datacatalog = datacatalog_v1.DataCatalogClient()
58+
return datacatalog.lookup_entry(linked_resource=resource_name)
59+
60+
61+
**After:**
62+
63+
.. code-block:: python
64+
65+
from google.cloud import datacatalog_v1
66+
datacatalog = datacatalog_v1.DataCatalogClient()
67+
return datacatalog.lookup_entry(request={'linked_resource': resource_name})
68+
69+
More Details
70+
^^^^^^^^^^^^
71+
72+
In `google-cloud-datacatalog<=1.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.
73+
74+
**Before:**
75+
76+
.. code-block:: python
77+
78+
def create_entry_group(
79+
self,
80+
parent,
81+
entry_group_id,
82+
entry_group=None,
83+
retry=google.api_core.gapic_v1.method.DEFAULT,
84+
timeout=google.api_core.gapic_v1.method.DEFAULT,
85+
metadata=None,
86+
):
87+
88+
Since the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.
89+
90+
Some methods have additional keyword only parameters. The available parameters depend on the `google.api.method_signature` annotation specified by the API producer.
91+
92+
93+
**After:**
94+
95+
.. code-block:: python
96+
97+
def create_entry_group(
98+
self,
99+
request: datacatalog.CreateEntryGroupRequest = None,
100+
*,
101+
parent: str = None,
102+
entry_group_id: str = None,
103+
entry_group: datacatalog.EntryGroup = None,
104+
retry: retries.Retry = gapic_v1.method.DEFAULT,
105+
timeout: float = None,
106+
metadata: Sequence[Tuple[str, str]] = (),
107+
) -> datacatalog.EntryGroup:
108+
109+
.. note::
110+
111+
The `request` parameter and flattened keyword parameters for the API are mutually exclusive.
112+
Passing both will result in an error.
113+
114+
Both of these calls are valid:
115+
116+
.. code-block:: python
117+
118+
response = client.create_entry_group(
119+
request={
120+
"parent": parent,
121+
"entry_group_id": entry_group_id,
122+
"entry_group": entry_group
123+
}
124+
)
125+
126+
.. code-block:: python
127+
128+
response = client.create_entry_group(
129+
parent=parent,
130+
entry_group_id=entry_group_id,
131+
entry_group=entry_group
132+
) # Make an API request.
133+
134+
This call is invalid because it mixes `request` with a keyword argument `entry_group`. Executing this code
135+
will result in an error.
136+
137+
.. code-block:: python
138+
139+
response = client.create_entry_group(
140+
request={
141+
"parent": parent,
142+
"entry_group_id"=entry_group_id
143+
},
144+
entry_group=entry_group
145+
)
146+
147+
148+
149+
Enums and Types
150+
---------------
151+
152+
+------------------------------+
153+
| Applicable previous versions |
154+
+==============================+
155+
| v2.0.0 or lower |
156+
+------------------------------+
157+
158+
.. warning:
159+
160+
**Breaking changes:**
161+
The submodules `enums` and `types` have been removed; the `type` attributes were renamed to `type_` to avoid name collisions.
162+
163+
**Before:**
164+
165+
.. code-block:: python
166+
167+
from google.cloud import datacatalog_v1
168+
entry = datacatalog_v1.types.Entry()
169+
entry.type = datacatalog_v1.enums.EntryType.FILESET
170+
171+
172+
**After:**
173+
174+
.. code-block:: python
175+
176+
from google.cloud import datacatalog_v1
177+
entry = datacatalog_v1.Entry()
178+
entry.type_ = datacatalog_v1.EntryType.FILESET
179+
180+
The renamed attributes are:
181+
182+
* `TagTemplateField.type` -> `TagTemplatedField.type_`
183+
* `ColumnSchema.type` -> `ColumnSchema.type_`
184+
* `Entry.type` -> `Entry.type_`
185+
186+
Common Resource Path Helper Methods
187+
-----------------------------------
188+
189+
+------------------------------+
190+
| Applicable previous versions |
191+
+==============================+
192+
| v1.0.0 or lower |
193+
+------------------------------+
194+
195+
The `location_path` method existing in `google-cloud-datacatalog<=1.0.0` was renamed to `common_location_path` in v3.0.0.
196+
197+
If you are upgrading from v1.0.0 or lower, modify your code to use new method name.
198+
199+
If you are upgrading from v2.0.0, and constructing paths manually as described in `previous upgrade guide <https://github.com/googleapis/python-datacatalog/blob/v2.0.0/UPGRADING.md#project-path-helper-methods>`_, now you can use `common_location_path` method.
200+
201+
There are also more resource path helper methods were added: `common_billing_account_path`, `common_folder_path`, `common_organization_path`, and `common_project_path`.

docs/UPGRADING.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/UPGRADING.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../UPGRADING.rst

0 commit comments

Comments
 (0)