diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 5fc5daa3..b8edda51 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:8555f0e37e6261408f792bfd6635102d2da5ad73f8f09bcb24f25e6afb5fac97 + digest: sha256:2e247c7bf5154df7f98cce087a20ca7605e236340c7d6d1a14447e5c06791bd6 diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in index 882178ce..ec867d9f 100644 --- a/.kokoro/requirements.in +++ b/.kokoro/requirements.in @@ -5,6 +5,6 @@ typing-extensions twine wheel setuptools -nox +nox>=2022.11.21 # required to remove dependency on py charset-normalizer<3 click<8.1.0 diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index fa99c129..66a2172a 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -1,6 +1,6 @@ # -# This file is autogenerated by pip-compile with python 3.10 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: # # pip-compile --allow-unsafe --generate-hashes requirements.in # @@ -335,9 +335,9 @@ more-itertools==9.0.0 \ --hash=sha256:250e83d7e81d0c87ca6bd942e6aeab8cc9daa6096d12c5308f3f92fa5e5c1f41 \ --hash=sha256:5a6257e40878ef0520b1803990e3e22303a41b5714006c32a3fd8304b26ea1ab # via jaraco-classes -nox==2022.8.7 \ - --hash=sha256:1b894940551dc5c389f9271d197ca5d655d40bdc6ccf93ed6880e4042760a34b \ - --hash=sha256:96cca88779e08282a699d672258ec01eb7c792d35bbbf538c723172bce23212c +nox==2022.11.21 \ + --hash=sha256:0e41a990e290e274cb205a976c4c97ee3c5234441a8132c8c3fd9ea3c22149eb \ + --hash=sha256:e21c31de0711d1274ca585a2c5fde36b1aa962005ba8e9322bf5eeed16dcd684 # via -r requirements.in packaging==21.3 \ --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ @@ -380,10 +380,6 @@ protobuf==3.20.3 \ # gcp-docuploader # gcp-releasetool # google-api-core -py==1.11.0 \ - --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ - --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 - # via nox pyasn1==0.4.8 \ --hash=sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d \ --hash=sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b5505621..a97b117e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.11.0" + ".": "3.11.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 40ccb6b7..7a7d3611 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ [1]: https://pypi.org/project/google-cloud-bigquery-datatransfer/#history +## [3.11.1](https://github.com/googleapis/python-bigquery-datatransfer/compare/v3.11.0...v3.11.1) (2023-03-27) + + +### Documentation + +* Fix formatting of request arg in docstring ([#455](https://github.com/googleapis/python-bigquery-datatransfer/issues/455)) ([40a85d6](https://github.com/googleapis/python-bigquery-datatransfer/commit/40a85d6eb5e40ff77c054c76bbdfe8a5b821e1ef)) +* Removes deprecated sample ([#451](https://github.com/googleapis/python-bigquery-datatransfer/issues/451)) ([250acb4](https://github.com/googleapis/python-bigquery-datatransfer/commit/250acb4ec89a33c54174659d33fd7088f22f93db)) +* Replace deprecated snippet ([e2f04db](https://github.com/googleapis/python-bigquery-datatransfer/commit/e2f04db7553721610903500133553e67fe717642)) + ## [3.11.0](https://github.com/googleapis/python-bigquery-datatransfer/compare/v3.10.1...v3.11.0) (2023-02-28) diff --git a/google/cloud/bigquery_datatransfer/gapic_version.py b/google/cloud/bigquery_datatransfer/gapic_version.py index 6c2e88f2..f897ec81 100644 --- a/google/cloud/bigquery_datatransfer/gapic_version.py +++ b/google/cloud/bigquery_datatransfer/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "3.11.0" # {x-release-please-version} +__version__ = "3.11.1" # {x-release-please-version} diff --git a/google/cloud/bigquery_datatransfer_v1/gapic_version.py b/google/cloud/bigquery_datatransfer_v1/gapic_version.py index 6c2e88f2..f897ec81 100644 --- a/google/cloud/bigquery_datatransfer_v1/gapic_version.py +++ b/google/cloud/bigquery_datatransfer_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "3.11.0" # {x-release-please-version} +__version__ = "3.11.1" # {x-release-please-version} diff --git a/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/async_client.py b/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/async_client.py index b5ebe937..151ca29e 100644 --- a/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/async_client.py +++ b/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/async_client.py @@ -390,7 +390,8 @@ async def sample_list_data_sources(): Args: request (Optional[Union[google.cloud.bigquery_datatransfer_v1.types.ListDataSourcesRequest, dict]]): The request object. Request to list supported data - sources and their data transfer settings. + sources and their data transfer + settings. parent (:class:`str`): Required. The BigQuery project id for which data sources should be returned. Must be in the form: @@ -521,13 +522,16 @@ async def sample_create_transfer_config(): Args: request (Optional[Union[google.cloud.bigquery_datatransfer_v1.types.CreateTransferConfigRequest, dict]]): The request object. A request to create a data transfer - configuration. If new credentials are needed for this - transfer configuration, authorization info must be - provided. If authorization info is provided, the - transfer configuration will be associated with the user - id corresponding to the authorization info. Otherwise, - the transfer configuration will be associated with the - calling user. + configuration. If new credentials are + needed for this transfer configuration, + authorization info must be provided. If + authorization info is provided, the + transfer configuration will be + associated with the user id + corresponding to the authorization info. + Otherwise, the transfer configuration + will be associated with the calling + user. parent (:class:`str`): Required. The BigQuery project id where the transfer configuration should be created. Must be in the format @@ -653,8 +657,9 @@ async def sample_update_transfer_config(): Args: request (Optional[Union[google.cloud.bigquery_datatransfer_v1.types.UpdateTransferConfigRequest, dict]]): The request object. A request to update a transfer - configuration. To update the user id of the transfer - configuration, authorization info needs to be provided. + configuration. To update the user id of + the transfer configuration, + authorization info needs to be provided. transfer_config (:class:`google.cloud.bigquery_datatransfer_v1.types.TransferConfig`): Required. Data transfer configuration to create. @@ -771,8 +776,9 @@ async def sample_delete_transfer_config(): Args: request (Optional[Union[google.cloud.bigquery_datatransfer_v1.types.DeleteTransferConfigRequest, dict]]): The request object. A request to delete data transfer - information. All associated transfer runs and log - messages will be deleted as well. + information. All associated transfer + runs and log messages will be deleted as + well. name (:class:`str`): Required. The field will contain name of the resource requested, for example: @@ -1450,8 +1456,8 @@ async def sample_delete_transfer_run(): Args: request (Optional[Union[google.cloud.bigquery_datatransfer_v1.types.DeleteTransferRunRequest, dict]]): - The request object. A request to delete data transfer - run information. + The request object. A request to delete data transfer run + information. name (:class:`str`): Required. The field will contain name of the resource requested, for example: @@ -1558,8 +1564,7 @@ async def sample_list_transfer_runs(): Args: request (Optional[Union[google.cloud.bigquery_datatransfer_v1.types.ListTransferRunsRequest, dict]]): - The request object. A request to list data transfer - runs. + The request object. A request to list data transfer runs. parent (:class:`str`): Required. Name of transfer configuration for which transfer runs should be retrieved. Format of transfer @@ -1687,7 +1692,8 @@ async def sample_list_transfer_logs(): Args: request (Optional[Union[google.cloud.bigquery_datatransfer_v1.types.ListTransferLogsRequest, dict]]): The request object. A request to get user facing log - messages associated with data transfer run. + messages associated with data transfer + run. parent (:class:`str`): Required. Transfer run name in the form: ``projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}`` @@ -1814,13 +1820,16 @@ async def sample_check_valid_creds(): Args: request (Optional[Union[google.cloud.bigquery_datatransfer_v1.types.CheckValidCredsRequest, dict]]): The request object. A request to determine whether the - user has valid credentials. This method is used to limit - the number of OAuth popups in the user interface. The - user id is inferred from the API call context. - If the data source has the Google+ authorization type, - this method returns false, as it cannot be determined - whether the credentials are already valid merely based - on the user id. + user has valid credentials. This method + is used to limit the number of OAuth + popups in the user interface. The user + id is inferred from the API call + context. If the data source has the + Google+ authorization type, this method + returns false, as it cannot be + determined whether the credentials are + already valid merely based on the user + id. name (:class:`str`): Required. The data source in the form: ``projects/{project_id}/dataSources/{data_source_id}`` @@ -1936,9 +1945,8 @@ async def sample_enroll_data_sources(): Args: request (Optional[Union[google.cloud.bigquery_datatransfer_v1.types.EnrollDataSourcesRequest, dict]]): - The request object. A request to enroll a set of data - sources so they are visible in the BigQuery UI's - `Transfer` tab. + The request object. A request to enroll a set of data sources so they are + visible in the BigQuery UI's ``Transfer`` tab. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/client.py b/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/client.py index 0495d040..6a866419 100644 --- a/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/client.py +++ b/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/client.py @@ -639,7 +639,8 @@ def sample_list_data_sources(): Args: request (Union[google.cloud.bigquery_datatransfer_v1.types.ListDataSourcesRequest, dict]): The request object. Request to list supported data - sources and their data transfer settings. + sources and their data transfer + settings. parent (str): Required. The BigQuery project id for which data sources should be returned. Must be in the form: @@ -760,13 +761,16 @@ def sample_create_transfer_config(): Args: request (Union[google.cloud.bigquery_datatransfer_v1.types.CreateTransferConfigRequest, dict]): The request object. A request to create a data transfer - configuration. If new credentials are needed for this - transfer configuration, authorization info must be - provided. If authorization info is provided, the - transfer configuration will be associated with the user - id corresponding to the authorization info. Otherwise, - the transfer configuration will be associated with the - calling user. + configuration. If new credentials are + needed for this transfer configuration, + authorization info must be provided. If + authorization info is provided, the + transfer configuration will be + associated with the user id + corresponding to the authorization info. + Otherwise, the transfer configuration + will be associated with the calling + user. parent (str): Required. The BigQuery project id where the transfer configuration should be created. Must be in the format @@ -892,8 +896,9 @@ def sample_update_transfer_config(): Args: request (Union[google.cloud.bigquery_datatransfer_v1.types.UpdateTransferConfigRequest, dict]): The request object. A request to update a transfer - configuration. To update the user id of the transfer - configuration, authorization info needs to be provided. + configuration. To update the user id of + the transfer configuration, + authorization info needs to be provided. transfer_config (google.cloud.bigquery_datatransfer_v1.types.TransferConfig): Required. Data transfer configuration to create. @@ -1010,8 +1015,9 @@ def sample_delete_transfer_config(): Args: request (Union[google.cloud.bigquery_datatransfer_v1.types.DeleteTransferConfigRequest, dict]): The request object. A request to delete data transfer - information. All associated transfer runs and log - messages will be deleted as well. + information. All associated transfer + runs and log messages will be deleted as + well. name (str): Required. The field will contain name of the resource requested, for example: @@ -1652,8 +1658,8 @@ def sample_delete_transfer_run(): Args: request (Union[google.cloud.bigquery_datatransfer_v1.types.DeleteTransferRunRequest, dict]): - The request object. A request to delete data transfer - run information. + The request object. A request to delete data transfer run + information. name (str): Required. The field will contain name of the resource requested, for example: @@ -1750,8 +1756,7 @@ def sample_list_transfer_runs(): Args: request (Union[google.cloud.bigquery_datatransfer_v1.types.ListTransferRunsRequest, dict]): - The request object. A request to list data transfer - runs. + The request object. A request to list data transfer runs. parent (str): Required. Name of transfer configuration for which transfer runs should be retrieved. Format of transfer @@ -1869,7 +1874,8 @@ def sample_list_transfer_logs(): Args: request (Union[google.cloud.bigquery_datatransfer_v1.types.ListTransferLogsRequest, dict]): The request object. A request to get user facing log - messages associated with data transfer run. + messages associated with data transfer + run. parent (str): Required. Transfer run name in the form: ``projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}`` @@ -1986,13 +1992,16 @@ def sample_check_valid_creds(): Args: request (Union[google.cloud.bigquery_datatransfer_v1.types.CheckValidCredsRequest, dict]): The request object. A request to determine whether the - user has valid credentials. This method is used to limit - the number of OAuth popups in the user interface. The - user id is inferred from the API call context. - If the data source has the Google+ authorization type, - this method returns false, as it cannot be determined - whether the credentials are already valid merely based - on the user id. + user has valid credentials. This method + is used to limit the number of OAuth + popups in the user interface. The user + id is inferred from the API call + context. If the data source has the + Google+ authorization type, this method + returns false, as it cannot be + determined whether the credentials are + already valid merely based on the user + id. name (str): Required. The data source in the form: ``projects/{project_id}/dataSources/{data_source_id}`` @@ -2098,9 +2107,8 @@ def sample_enroll_data_sources(): Args: request (Union[google.cloud.bigquery_datatransfer_v1.types.EnrollDataSourcesRequest, dict]): - The request object. A request to enroll a set of data - sources so they are visible in the BigQuery UI's - `Transfer` tab. + The request object. A request to enroll a set of data sources so they are + visible in the BigQuery UI's ``Transfer`` tab. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/rest.py b/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/rest.py index 4ab502f8..87a34fa1 100644 --- a/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/rest.py +++ b/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/rest.py @@ -673,7 +673,6 @@ def __call__( determined whether the credentials are already valid merely based on the user id. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -788,7 +787,6 @@ def __call__( Otherwise, the transfer configuration will be associated with the calling user. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -901,7 +899,6 @@ def __call__( information. All associated transfer runs and log messages will be deleted as well. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -983,7 +980,6 @@ def __call__( request (~.datatransfer.DeleteTransferRunRequest): The request object. A request to delete data transfer run information. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1055,7 +1051,6 @@ def __call__( request (~.datatransfer.EnrollDataSourcesRequest): The request object. A request to enroll a set of data sources so they are visible in the BigQuery UI's ``Transfer`` tab. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1238,7 +1233,6 @@ def __call__( request (~.datatransfer.GetTransferConfigRequest): The request object. A request to get data transfer information. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1339,7 +1333,6 @@ def __call__( request (~.datatransfer.GetTransferRunRequest): The request object. A request to get data transfer run information. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1434,7 +1427,6 @@ def __call__( The request object. Request to list supported data sources and their data transfer settings. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1530,7 +1522,6 @@ def __call__( request (~.datatransfer.ListTransferConfigsRequest): The request object. A request to list data transfers configured for a BigQuery project. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1627,7 +1618,6 @@ def __call__( The request object. A request to get user facing log messages associated with data transfer run. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1817,7 +1807,6 @@ def __call__( request (~.datatransfer.ScheduleTransferRunsRequest): The request object. A request to schedule transfer runs for a time range. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1914,7 +1903,6 @@ def __call__( request (~.datatransfer.StartManualTransferRunsRequest): The request object. A request to start manual transfer runs. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2023,7 +2011,6 @@ def __call__( configuration. To update the user id of the transfer configuration, authorization info needs to be provided. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/samples/generated_samples/snippet_metadata_google.cloud.bigquery.datatransfer.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.bigquery.datatransfer.v1.json index ff4d7442..1c451996 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.bigquery.datatransfer.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.bigquery.datatransfer.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-bigquery-datatransfer", - "version": "3.11.0" + "version": "3.11.1" }, "snippets": [ { diff --git a/samples/snippets/manage_transfer_configs.py b/samples/snippets/manage_transfer_configs.py index 6b4abd78..cd865455 100644 --- a/samples/snippets/manage_transfer_configs.py +++ b/samples/snippets/manage_transfer_configs.py @@ -105,14 +105,19 @@ def update_credentials_with_service_account(override_values={}): return transfer_config -def schedule_backfill(override_values={}): +def schedule_backfill_manual_transfer(override_values={}): # [START bigquerydatatransfer_schedule_backfill] import datetime - from google.cloud import bigquery_datatransfer + from google.cloud.bigquery_datatransfer_v1 import ( + DataTransferServiceClient, + StartManualTransferRunsRequest, + ) - transfer_client = bigquery_datatransfer.DataTransferServiceClient() + # Create a client object + client = DataTransferServiceClient() + # Replace with your transfer configuration name transfer_config_name = "projects/1234/locations/us/transferConfigs/abcd" # [END bigquerydatatransfer_schedule_backfill] # To facilitate testing, we replace values with alternatives @@ -134,13 +139,22 @@ def schedule_backfill(override_values={}): end_time.year, end_time.month, end_time.day, tzinfo=datetime.timezone.utc ) - response = transfer_client.schedule_transfer_runs( - parent=transfer_config_name, + requested_time_range = StartManualTransferRunsRequest.TimeRange( start_time=start_time, end_time=end_time, ) - print("Started transfer runs:") + # Initialize request argument(s) + request = StartManualTransferRunsRequest( + parent=transfer_config_name, + requested_time_range=requested_time_range, + ) + + # Make the request + response = client.start_manual_transfer_runs(request=request) + + # Handle the response + print("Started manual transfer runs:") for run in response.runs: print(f"backfill: {run.run_time} run: {run.name}") # [END bigquerydatatransfer_schedule_backfill] diff --git a/samples/snippets/manage_transfer_configs_test.py b/samples/snippets/manage_transfer_configs_test.py index 52d16dc2..5504f19c 100644 --- a/samples/snippets/manage_transfer_configs_test.py +++ b/samples/snippets/manage_transfer_configs_test.py @@ -50,16 +50,16 @@ def test_update_credentials_with_service_account( assert transfer_config_name in out -def test_schedule_backfill(capsys, transfer_config_name): - runs = manage_transfer_configs.schedule_backfill( +def test_schedule_backfill_manual_transfer(capsys, transfer_config_name): + runs = manage_transfer_configs.schedule_backfill_manual_transfer( {"transfer_config_name": transfer_config_name} ) out, _ = capsys.readouterr() - assert "Started transfer runs:" in out + assert "Started manual transfer runs:" in out # Run IDs should include the transfer name in their path. assert transfer_config_name in out - # Check that there are runs for 5, 4, 3, and 2 days ago. - assert len(runs) == 4 + # Check that there are three runs for between 2 and 5 days ago. + assert len(runs) == 3 def test_delete_config(capsys, transfer_config_name): diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt index bbc2a702..20d47eed 100644 --- a/samples/snippets/requirements-test.txt +++ b/samples/snippets/requirements-test.txt @@ -1,4 +1,4 @@ google-cloud-bigquery==3.6.0 google-cloud-pubsub==2.15.0 -pytest==7.2.1 +pytest==7.2.2 mock==5.0.1 diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 13e5c5de..047407db 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-bigquery-datatransfer==3.10.1 +google-cloud-bigquery-datatransfer==3.11.0