From 8c70169a082521b1cfd5e96f115b0184b967d39e Mon Sep 17 00:00:00 2001 From: Valentyn Tymofieiev Date: Mon, 4 Feb 2019 18:40:23 +0000 Subject: [PATCH 1/2] Regenerate BQ client to match apitools==0.5.26 --- .../clients/bigquery/bigquery_v2_client.py | 49 ++-- .../clients/bigquery/bigquery_v2_messages.py | 261 ++++++++++-------- 2 files changed, 165 insertions(+), 145 deletions(-) diff --git a/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_client.py b/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_client.py index 7f688722f0942..25d3e52535347 100644 --- a/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_client.py +++ b/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_client.py @@ -45,7 +45,7 @@ def __init__(self, url='', credentials=None, get_credentials=True, http=None, model=None, log_request=False, log_response=False, credentials_args=None, default_global_params=None, - additional_http_headers=None): + additional_http_headers=None, response_encoding=None): """Create a new bigquery handle.""" url = url or self.BASE_URL super(BigqueryV2, self).__init__( @@ -54,7 +54,8 @@ def __init__(self, url='', credentials=None, log_request=log_request, log_response=log_response, credentials_args=credentials_args, default_global_params=default_global_params, - additional_http_headers=additional_http_headers) + additional_http_headers=additional_http_headers, + response_encoding=response_encoding) self.datasets = self.DatasetsService(self) self.jobs = self.JobsService(self) self.projects = self.ProjectsService(self) @@ -72,7 +73,7 @@ def __init__(self, client): } def Delete(self, request, global_params=None): - """Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name. + r"""Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name. Args: request: (BigqueryDatasetsDeleteRequest) input message @@ -98,7 +99,7 @@ def Delete(self, request, global_params=None): ) def Get(self, request, global_params=None): - """Returns the dataset specified by datasetID. + r"""Returns the dataset specified by datasetID. Args: request: (BigqueryDatasetsGetRequest) input message @@ -124,7 +125,7 @@ def Get(self, request, global_params=None): ) def Insert(self, request, global_params=None): - """Creates a new empty dataset. + r"""Creates a new empty dataset. Args: request: (BigqueryDatasetsInsertRequest) input message @@ -150,7 +151,7 @@ def Insert(self, request, global_params=None): ) def List(self, request, global_params=None): - """Lists all datasets in the specified project to which you have been granted the READER dataset role. + r"""Lists all datasets in the specified project to which you have been granted the READER dataset role. Args: request: (BigqueryDatasetsListRequest) input message @@ -176,7 +177,7 @@ def List(self, request, global_params=None): ) def Patch(self, request, global_params=None): - """Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports patch semantics. + r"""Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports patch semantics. Args: request: (BigqueryDatasetsPatchRequest) input message @@ -202,7 +203,7 @@ def Patch(self, request, global_params=None): ) def Update(self, request, global_params=None): - """Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. + r"""Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. Args: request: (BigqueryDatasetsUpdateRequest) input message @@ -246,7 +247,7 @@ def __init__(self, client): } def Cancel(self, request, global_params=None): - """Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs. + r"""Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs. Args: request: (BigqueryJobsCancelRequest) input message @@ -272,7 +273,7 @@ def Cancel(self, request, global_params=None): ) def Get(self, request, global_params=None): - """Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role. + r"""Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role. Args: request: (BigqueryJobsGetRequest) input message @@ -298,7 +299,7 @@ def Get(self, request, global_params=None): ) def GetQueryResults(self, request, global_params=None): - """Retrieves the results of a query job. + r"""Retrieves the results of a query job. Args: request: (BigqueryJobsGetQueryResultsRequest) input message @@ -324,7 +325,7 @@ def GetQueryResults(self, request, global_params=None): ) def Insert(self, request, global_params=None, upload=None): - """Starts a new asynchronous job. Requires the Can View project role. + r"""Starts a new asynchronous job. Requires the Can View project role. Args: request: (BigqueryJobsInsertRequest) input message @@ -354,7 +355,7 @@ def Insert(self, request, global_params=None, upload=None): ) def List(self, request, global_params=None): - """Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property. + r"""Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property. Args: request: (BigqueryJobsListRequest) input message @@ -380,7 +381,7 @@ def List(self, request, global_params=None): ) def Query(self, request, global_params=None): - """Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout. + r"""Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout. Args: request: (BigqueryJobsQueryRequest) input message @@ -416,7 +417,7 @@ def __init__(self, client): } def GetServiceAccount(self, request, global_params=None): - """Returns the email address of the service account for your project used for interactions with Google Cloud KMS. + r"""Returns the email address of the service account for your project used for interactions with Google Cloud KMS. Args: request: (BigqueryProjectsGetServiceAccountRequest) input message @@ -442,7 +443,7 @@ def GetServiceAccount(self, request, global_params=None): ) def List(self, request, global_params=None): - """Lists all projects to which you have been granted any project role. + r"""Lists all projects to which you have been granted any project role. Args: request: (BigqueryProjectsListRequest) input message @@ -478,7 +479,7 @@ def __init__(self, client): } def InsertAll(self, request, global_params=None): - """Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role. + r"""Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role. Args: request: (BigqueryTabledataInsertAllRequest) input message @@ -504,7 +505,7 @@ def InsertAll(self, request, global_params=None): ) def List(self, request, global_params=None): - """Retrieves table data from a specified set of rows. Requires the READER dataset role. + r"""Retrieves table data from a specified set of rows. Requires the READER dataset role. Args: request: (BigqueryTabledataListRequest) input message @@ -540,7 +541,7 @@ def __init__(self, client): } def Delete(self, request, global_params=None): - """Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted. + r"""Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted. Args: request: (BigqueryTablesDeleteRequest) input message @@ -566,7 +567,7 @@ def Delete(self, request, global_params=None): ) def Get(self, request, global_params=None): - """Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table. + r"""Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table. Args: request: (BigqueryTablesGetRequest) input message @@ -592,7 +593,7 @@ def Get(self, request, global_params=None): ) def Insert(self, request, global_params=None): - """Creates a new, empty table in the dataset. + r"""Creates a new, empty table in the dataset. Args: request: (BigqueryTablesInsertRequest) input message @@ -618,7 +619,7 @@ def Insert(self, request, global_params=None): ) def List(self, request, global_params=None): - """Lists all tables in the specified dataset. Requires the READER dataset role. + r"""Lists all tables in the specified dataset. Requires the READER dataset role. Args: request: (BigqueryTablesListRequest) input message @@ -644,7 +645,7 @@ def List(self, request, global_params=None): ) def Patch(self, request, global_params=None): - """Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports patch semantics. + r"""Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports patch semantics. Args: request: (BigqueryTablesPatchRequest) input message @@ -670,7 +671,7 @@ def Patch(self, request, global_params=None): ) def Update(self, request, global_params=None): - """Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. + r"""Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. Args: request: (BigqueryTablesUpdateRequest) input message diff --git a/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_messages.py b/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_messages.py index 9669840f43768..61c64e53a2794 100644 --- a/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_messages.py +++ b/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_messages.py @@ -32,7 +32,7 @@ class BigQueryModelTraining(_messages.Message): - """A BigQueryModelTraining object. + r"""A BigQueryModelTraining object. Fields: currentIteration: [Output-only, Beta] Index of current ML training @@ -48,7 +48,7 @@ class BigQueryModelTraining(_messages.Message): class BigqueryDatasetsDeleteRequest(_messages.Message): - """A BigqueryDatasetsDeleteRequest object. + r"""A BigqueryDatasetsDeleteRequest object. Fields: datasetId: Dataset ID of dataset being deleted @@ -63,11 +63,11 @@ class BigqueryDatasetsDeleteRequest(_messages.Message): class BigqueryDatasetsDeleteResponse(_messages.Message): - """An empty BigqueryDatasetsDelete response.""" + r"""An empty BigqueryDatasetsDelete response.""" class BigqueryDatasetsGetRequest(_messages.Message): - """A BigqueryDatasetsGetRequest object. + r"""A BigqueryDatasetsGetRequest object. Fields: datasetId: Dataset ID of the requested dataset @@ -79,7 +79,7 @@ class BigqueryDatasetsGetRequest(_messages.Message): class BigqueryDatasetsInsertRequest(_messages.Message): - """A BigqueryDatasetsInsertRequest object. + r"""A BigqueryDatasetsInsertRequest object. Fields: dataset: A Dataset resource to be passed as the request body. @@ -91,7 +91,7 @@ class BigqueryDatasetsInsertRequest(_messages.Message): class BigqueryDatasetsListRequest(_messages.Message): - """A BigqueryDatasetsListRequest object. + r"""A BigqueryDatasetsListRequest object. Fields: all: Whether to list all datasets, including hidden ones @@ -114,7 +114,7 @@ class BigqueryDatasetsListRequest(_messages.Message): class BigqueryDatasetsPatchRequest(_messages.Message): - """A BigqueryDatasetsPatchRequest object. + r"""A BigqueryDatasetsPatchRequest object. Fields: dataset: A Dataset resource to be passed as the request body. @@ -128,7 +128,7 @@ class BigqueryDatasetsPatchRequest(_messages.Message): class BigqueryDatasetsUpdateRequest(_messages.Message): - """A BigqueryDatasetsUpdateRequest object. + r"""A BigqueryDatasetsUpdateRequest object. Fields: dataset: A Dataset resource to be passed as the request body. @@ -142,7 +142,7 @@ class BigqueryDatasetsUpdateRequest(_messages.Message): class BigqueryJobsCancelRequest(_messages.Message): - """A BigqueryJobsCancelRequest object. + r"""A BigqueryJobsCancelRequest object. Fields: jobId: [Required] Job ID of the job to cancel @@ -158,7 +158,7 @@ class BigqueryJobsCancelRequest(_messages.Message): class BigqueryJobsGetQueryResultsRequest(_messages.Message): - """A BigqueryJobsGetQueryResultsRequest object. + r"""A BigqueryJobsGetQueryResultsRequest object. Fields: jobId: [Required] Job ID of the query job @@ -185,7 +185,7 @@ class BigqueryJobsGetQueryResultsRequest(_messages.Message): class BigqueryJobsGetRequest(_messages.Message): - """A BigqueryJobsGetRequest object. + r"""A BigqueryJobsGetRequest object. Fields: jobId: [Required] Job ID of the requested job @@ -201,7 +201,7 @@ class BigqueryJobsGetRequest(_messages.Message): class BigqueryJobsInsertRequest(_messages.Message): - """A BigqueryJobsInsertRequest object. + r"""A BigqueryJobsInsertRequest object. Fields: job: A Job resource to be passed as the request body. @@ -213,7 +213,7 @@ class BigqueryJobsInsertRequest(_messages.Message): class BigqueryJobsListRequest(_messages.Message): - """A BigqueryJobsListRequest object. + r"""A BigqueryJobsListRequest object. Enums: ProjectionValueValuesEnum: Restrict information returned to a set of @@ -238,7 +238,7 @@ class BigqueryJobsListRequest(_messages.Message): """ class ProjectionValueValuesEnum(_messages.Enum): - """Restrict information returned to a set of selected fields + r"""Restrict information returned to a set of selected fields Values: full: Includes all job data @@ -248,7 +248,7 @@ class ProjectionValueValuesEnum(_messages.Enum): minimal = 1 class StateFilterValueValuesEnum(_messages.Enum): - """Filter for job state + r"""Filter for job state Values: done: Finished jobs @@ -270,7 +270,7 @@ class StateFilterValueValuesEnum(_messages.Enum): class BigqueryJobsQueryRequest(_messages.Message): - """A BigqueryJobsQueryRequest object. + r"""A BigqueryJobsQueryRequest object. Fields: projectId: Project ID of the project billed for the query @@ -282,7 +282,7 @@ class BigqueryJobsQueryRequest(_messages.Message): class BigqueryProjectsGetServiceAccountRequest(_messages.Message): - """A BigqueryProjectsGetServiceAccountRequest object. + r"""A BigqueryProjectsGetServiceAccountRequest object. Fields: projectId: Project ID for which the service account is requested. @@ -292,7 +292,7 @@ class BigqueryProjectsGetServiceAccountRequest(_messages.Message): class BigqueryProjectsListRequest(_messages.Message): - """A BigqueryProjectsListRequest object. + r"""A BigqueryProjectsListRequest object. Fields: maxResults: Maximum number of results to return @@ -305,7 +305,7 @@ class BigqueryProjectsListRequest(_messages.Message): class BigqueryTabledataInsertAllRequest(_messages.Message): - """A BigqueryTabledataInsertAllRequest object. + r"""A BigqueryTabledataInsertAllRequest object. Fields: datasetId: Dataset ID of the destination table. @@ -322,7 +322,7 @@ class BigqueryTabledataInsertAllRequest(_messages.Message): class BigqueryTabledataListRequest(_messages.Message): - """A BigqueryTabledataListRequest object. + r"""A BigqueryTabledataListRequest object. Fields: datasetId: Dataset ID of the table to read @@ -346,7 +346,7 @@ class BigqueryTabledataListRequest(_messages.Message): class BigqueryTablesDeleteRequest(_messages.Message): - """A BigqueryTablesDeleteRequest object. + r"""A BigqueryTablesDeleteRequest object. Fields: datasetId: Dataset ID of the table to delete @@ -360,11 +360,11 @@ class BigqueryTablesDeleteRequest(_messages.Message): class BigqueryTablesDeleteResponse(_messages.Message): - """An empty BigqueryTablesDelete response.""" + r"""An empty BigqueryTablesDelete response.""" class BigqueryTablesGetRequest(_messages.Message): - """A BigqueryTablesGetRequest object. + r"""A BigqueryTablesGetRequest object. Fields: datasetId: Dataset ID of the requested table @@ -381,7 +381,7 @@ class BigqueryTablesGetRequest(_messages.Message): class BigqueryTablesInsertRequest(_messages.Message): - """A BigqueryTablesInsertRequest object. + r"""A BigqueryTablesInsertRequest object. Fields: datasetId: Dataset ID of the new table @@ -395,7 +395,7 @@ class BigqueryTablesInsertRequest(_messages.Message): class BigqueryTablesListRequest(_messages.Message): - """A BigqueryTablesListRequest object. + r"""A BigqueryTablesListRequest object. Fields: datasetId: Dataset ID of the tables to list @@ -412,7 +412,7 @@ class BigqueryTablesListRequest(_messages.Message): class BigqueryTablesPatchRequest(_messages.Message): - """A BigqueryTablesPatchRequest object. + r"""A BigqueryTablesPatchRequest object. Fields: datasetId: Dataset ID of the table to update @@ -428,7 +428,7 @@ class BigqueryTablesPatchRequest(_messages.Message): class BigqueryTablesUpdateRequest(_messages.Message): - """A BigqueryTablesUpdateRequest object. + r"""A BigqueryTablesUpdateRequest object. Fields: datasetId: Dataset ID of the table to update @@ -444,7 +444,7 @@ class BigqueryTablesUpdateRequest(_messages.Message): class BigtableColumn(_messages.Message): - """A BigtableColumn object. + r"""A BigtableColumn object. Fields: encoding: [Optional] The encoding of the values when the type is not @@ -488,7 +488,7 @@ class BigtableColumn(_messages.Message): class BigtableColumnFamily(_messages.Message): - """A BigtableColumnFamily object. + r"""A BigtableColumnFamily object. Fields: columns: [Optional] Lists of columns that should be exposed as individual @@ -522,7 +522,7 @@ class BigtableColumnFamily(_messages.Message): class BigtableOptions(_messages.Message): - """A BigtableOptions object. + r"""A BigtableOptions object. Fields: columnFamilies: [Optional] List of column families to expose in the table @@ -549,7 +549,7 @@ class BigtableOptions(_messages.Message): class Clustering(_messages.Message): - """A Clustering object. + r"""A Clustering object. Fields: fields: [Repeated] One or more fields on which data should be clustered. @@ -563,7 +563,7 @@ class Clustering(_messages.Message): class CsvOptions(_messages.Message): - """A CsvOptions object. + r"""A CsvOptions object. Fields: allowJaggedRows: [Optional] Indicates if BigQuery should accept rows that @@ -606,7 +606,7 @@ class CsvOptions(_messages.Message): class Dataset(_messages.Message): - """A Dataset object. + r"""A Dataset object. Messages: AccessValueListEntry: A AccessValueListEntry object. @@ -673,7 +673,7 @@ class Dataset(_messages.Message): """ class AccessValueListEntry(_messages.Message): - """A AccessValueListEntry object. + r"""A AccessValueListEntry object. Fields: domain: [Pick one] A domain to grant access to. Any users signed in with @@ -711,7 +711,7 @@ class AccessValueListEntry(_messages.Message): @encoding.MapUnrecognizedFields('additionalProperties') class LabelsValue(_messages.Message): - """The labels associated with this dataset. You can use these to organize + r"""The labels associated with this dataset. You can use these to organize and group your datasets. You can set this property when inserting or updating a dataset. See Creating and Updating Dataset Labels for more information. @@ -724,7 +724,7 @@ class LabelsValue(_messages.Message): """ class AdditionalProperty(_messages.Message): - """An additional property for a LabelsValue object. + r"""An additional property for a LabelsValue object. Fields: key: Name of the additional property. @@ -753,7 +753,7 @@ class AdditionalProperty(_messages.Message): class DatasetList(_messages.Message): - """A DatasetList object. + r"""A DatasetList object. Messages: DatasetsValueListEntry: A DatasetsValueListEntry object. @@ -772,7 +772,7 @@ class DatasetList(_messages.Message): """ class DatasetsValueListEntry(_messages.Message): - """A DatasetsValueListEntry object. + r"""A DatasetsValueListEntry object. Messages: LabelsValue: The labels associated with this dataset. You can use these @@ -792,7 +792,7 @@ class DatasetsValueListEntry(_messages.Message): @encoding.MapUnrecognizedFields('additionalProperties') class LabelsValue(_messages.Message): - """The labels associated with this dataset. You can use these to + r"""The labels associated with this dataset. You can use these to organize and group your datasets. Messages: @@ -803,7 +803,7 @@ class LabelsValue(_messages.Message): """ class AdditionalProperty(_messages.Message): - """An additional property for a LabelsValue object. + r"""An additional property for a LabelsValue object. Fields: key: Name of the additional property. @@ -829,7 +829,7 @@ class AdditionalProperty(_messages.Message): class DatasetReference(_messages.Message): - """A DatasetReference object. + r"""A DatasetReference object. Fields: datasetId: [Required] A unique ID for this dataset, without the project @@ -843,7 +843,7 @@ class DatasetReference(_messages.Message): class DestinationTableProperties(_messages.Message): - """A DestinationTableProperties object. + r"""A DestinationTableProperties object. Fields: description: [Optional] The description for the destination table. This @@ -861,7 +861,7 @@ class DestinationTableProperties(_messages.Message): class EncryptionConfiguration(_messages.Message): - """A EncryptionConfiguration object. + r"""A EncryptionConfiguration object. Fields: kmsKeyName: [Optional] Describes the Cloud KMS encryption key that will be @@ -873,7 +873,7 @@ class EncryptionConfiguration(_messages.Message): class ErrorProto(_messages.Message): - """A ErrorProto object. + r"""A ErrorProto object. Fields: debugInfo: Debugging information. This property is internal to Google and @@ -890,7 +890,7 @@ class ErrorProto(_messages.Message): class ExplainQueryStage(_messages.Message): - """A ExplainQueryStage object. + r"""A ExplainQueryStage object. Fields: completedParallelInputs: Number of parallel input segments completed. @@ -966,7 +966,7 @@ class ExplainQueryStage(_messages.Message): class ExplainQueryStep(_messages.Message): - """A ExplainQueryStep object. + r"""A ExplainQueryStep object. Fields: kind: Machine-readable operation type. @@ -978,7 +978,7 @@ class ExplainQueryStep(_messages.Message): class ExternalDataConfiguration(_messages.Message): - """A ExternalDataConfiguration object. + r"""A ExternalDataConfiguration object. Fields: autodetect: Try to detect schema and format options automatically. Any @@ -1045,7 +1045,7 @@ class ExternalDataConfiguration(_messages.Message): class GetQueryResultsResponse(_messages.Message): - """A GetQueryResultsResponse object. + r"""A GetQueryResultsResponse object. Fields: cacheHit: Whether the query result was fetched from the query cache. @@ -1094,7 +1094,7 @@ class GetQueryResultsResponse(_messages.Message): class GetServiceAccountResponse(_messages.Message): - """A GetServiceAccountResponse object. + r"""A GetServiceAccountResponse object. Fields: email: The service account email address. @@ -1106,7 +1106,7 @@ class GetServiceAccountResponse(_messages.Message): class GoogleSheetsOptions(_messages.Message): - """A GoogleSheetsOptions object. + r"""A GoogleSheetsOptions object. Fields: range: [Beta] [Optional] Range of a sheet to query from. Only used when @@ -1132,7 +1132,7 @@ class GoogleSheetsOptions(_messages.Message): class IterationResult(_messages.Message): - """A IterationResult object. + r"""A IterationResult object. Fields: durationMs: [Output-only, Beta] Time taken to run the training iteration @@ -1159,7 +1159,7 @@ class IterationResult(_messages.Message): class Job(_messages.Message): - """A Job object. + r"""A Job object. Fields: configuration: [Required] Describes the job configuration. @@ -1189,7 +1189,7 @@ class Job(_messages.Message): class JobCancelResponse(_messages.Message): - """A JobCancelResponse object. + r"""A JobCancelResponse object. Fields: job: The final state of the job. @@ -1201,7 +1201,7 @@ class JobCancelResponse(_messages.Message): class JobConfiguration(_messages.Message): - """A JobConfiguration object. + r"""A JobConfiguration object. Messages: LabelsValue: The labels associated with this job. You can use these to @@ -1234,7 +1234,7 @@ class JobConfiguration(_messages.Message): @encoding.MapUnrecognizedFields('additionalProperties') class LabelsValue(_messages.Message): - """The labels associated with this job. You can use these to organize and + r"""The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values @@ -1249,7 +1249,7 @@ class LabelsValue(_messages.Message): """ class AdditionalProperty(_messages.Message): - """An additional property for a LabelsValue object. + r"""An additional property for a LabelsValue object. Fields: key: Name of the additional property. @@ -1272,7 +1272,7 @@ class AdditionalProperty(_messages.Message): class JobConfigurationExtract(_messages.Message): - """A JobConfigurationExtract object. + r"""A JobConfigurationExtract object. Fields: compression: [Optional] The compression type to use for exported files. @@ -1466,7 +1466,7 @@ class JobConfigurationLoad(_messages.Message): class JobConfigurationQuery(_messages.Message): - """A JobConfigurationQuery object. + r"""A JobConfigurationQuery object. Messages: TableDefinitionsValue: [Optional] If querying an external data source @@ -1567,7 +1567,7 @@ class JobConfigurationQuery(_messages.Message): @encoding.MapUnrecognizedFields('additionalProperties') class TableDefinitionsValue(_messages.Message): - """[Optional] If querying an external data source outside of BigQuery, + r"""[Optional] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. @@ -1582,7 +1582,7 @@ class TableDefinitionsValue(_messages.Message): """ class AdditionalProperty(_messages.Message): - """An additional property for a TableDefinitionsValue object. + r"""An additional property for a TableDefinitionsValue object. Fields: key: Name of the additional property. @@ -1619,7 +1619,7 @@ class AdditionalProperty(_messages.Message): class JobConfigurationTableCopy(_messages.Message): - """A JobConfigurationTableCopy object. + r"""A JobConfigurationTableCopy object. Fields: createDisposition: [Optional] Specifies whether the job is allowed to @@ -1654,7 +1654,7 @@ class JobConfigurationTableCopy(_messages.Message): class JobList(_messages.Message): - """A JobList object. + r"""A JobList object. Messages: JobsValueListEntry: A JobsValueListEntry object. @@ -1667,7 +1667,7 @@ class JobList(_messages.Message): """ class JobsValueListEntry(_messages.Message): - """A JobsValueListEntry object. + r"""A JobsValueListEntry object. Fields: configuration: [Full-projection-only] Specifies the job configuration. @@ -1702,7 +1702,7 @@ class JobsValueListEntry(_messages.Message): class JobReference(_messages.Message): - """A JobReference object. + r"""A JobReference object. Fields: jobId: [Required] The ID of the job. The ID must contain only letters @@ -1720,7 +1720,7 @@ class JobReference(_messages.Message): class JobStatistics(_messages.Message): - """A JobStatistics object. + r"""A JobStatistics object. Messages: ReservationUsageValueListEntry: A ReservationUsageValueListEntry object. @@ -1747,7 +1747,7 @@ class JobStatistics(_messages.Message): """ class ReservationUsageValueListEntry(_messages.Message): - """A ReservationUsageValueListEntry object. + r"""A ReservationUsageValueListEntry object. Fields: name: [Output-only] Reservation name or "unreserved" for on-demand @@ -1773,7 +1773,7 @@ class ReservationUsageValueListEntry(_messages.Message): class JobStatistics2(_messages.Message): - """A JobStatistics2 object. + r"""A JobStatistics2 object. Messages: ReservationUsageValueListEntry: A ReservationUsageValueListEntry object. @@ -1839,7 +1839,7 @@ class JobStatistics2(_messages.Message): """ class ReservationUsageValueListEntry(_messages.Message): - """A ReservationUsageValueListEntry object. + r"""A ReservationUsageValueListEntry object. Fields: name: [Output-only] Reservation name or "unreserved" for on-demand @@ -1875,7 +1875,7 @@ class ReservationUsageValueListEntry(_messages.Message): class JobStatistics3(_messages.Message): - """A JobStatistics3 object. + r"""A JobStatistics3 object. Fields: badRecords: [Output-only] The number of bad records encountered. Note that @@ -1899,7 +1899,7 @@ class JobStatistics3(_messages.Message): class JobStatistics4(_messages.Message): - """A JobStatistics4 object. + r"""A JobStatistics4 object. Fields: destinationUriFileCounts: [Output-only] Number of files per destination @@ -1912,7 +1912,7 @@ class JobStatistics4(_messages.Message): class JobStatus(_messages.Message): - """A JobStatus object. + r"""A JobStatus object. Fields: errorResult: [Output-only] Final error result of the job. If present, @@ -1931,7 +1931,7 @@ class JobStatus(_messages.Message): @encoding.MapUnrecognizedFields('additionalProperties') class JsonObject(_messages.Message): - """Represents a single JSON object. + r"""Represents a single JSON object. Messages: AdditionalProperty: An additional property for a JsonObject object. @@ -1941,7 +1941,7 @@ class JsonObject(_messages.Message): """ class AdditionalProperty(_messages.Message): - """An additional property for a JsonObject object. + r"""An additional property for a JsonObject object. Fields: key: Name of the additional property. @@ -1958,7 +1958,7 @@ class AdditionalProperty(_messages.Message): class MaterializedViewDefinition(_messages.Message): - """A MaterializedViewDefinition object. + r"""A MaterializedViewDefinition object. Fields: lastRefreshTime: [Output-only] [TrustedTester] The time when this @@ -1971,7 +1971,7 @@ class MaterializedViewDefinition(_messages.Message): class ModelDefinition(_messages.Message): - """A ModelDefinition object. + r"""A ModelDefinition object. Messages: ModelOptionsValue: [Output-only, Beta] Model options used for the first @@ -1991,7 +1991,7 @@ class ModelDefinition(_messages.Message): """ class ModelOptionsValue(_messages.Message): - """[Output-only, Beta] Model options used for the first training run. + r"""[Output-only, Beta] Model options used for the first training run. These options are immutable for subsequent training runs. Default values are used for any options not specified in the input query. @@ -2010,7 +2010,7 @@ class ModelOptionsValue(_messages.Message): class ProjectList(_messages.Message): - """A ProjectList object. + r"""A ProjectList object. Messages: ProjectsValueListEntry: A ProjectsValueListEntry object. @@ -2024,7 +2024,7 @@ class ProjectList(_messages.Message): """ class ProjectsValueListEntry(_messages.Message): - """A ProjectsValueListEntry object. + r"""A ProjectsValueListEntry object. Fields: friendlyName: A descriptive name for this project. @@ -2048,7 +2048,7 @@ class ProjectsValueListEntry(_messages.Message): class ProjectReference(_messages.Message): - """A ProjectReference object. + r"""A ProjectReference object. Fields: projectId: [Required] ID of the project. Can be either the numeric ID or @@ -2059,7 +2059,7 @@ class ProjectReference(_messages.Message): class QueryParameter(_messages.Message): - """A QueryParameter object. + r"""A QueryParameter object. Fields: name: [Optional] If unset, this is a positional parameter. Otherwise, @@ -2074,7 +2074,7 @@ class QueryParameter(_messages.Message): class QueryParameterType(_messages.Message): - """A QueryParameterType object. + r"""A QueryParameterType object. Messages: StructTypesValueListEntry: A StructTypesValueListEntry object. @@ -2088,7 +2088,7 @@ class QueryParameterType(_messages.Message): """ class StructTypesValueListEntry(_messages.Message): - """A StructTypesValueListEntry object. + r"""A StructTypesValueListEntry object. Fields: description: [Optional] Human-oriented description of the field. @@ -2106,7 +2106,7 @@ class StructTypesValueListEntry(_messages.Message): class QueryParameterValue(_messages.Message): - """A QueryParameterValue object. + r"""A QueryParameterValue object. Messages: StructValuesValue: [Optional] The struct field values, in order of the @@ -2121,7 +2121,7 @@ class QueryParameterValue(_messages.Message): @encoding.MapUnrecognizedFields('additionalProperties') class StructValuesValue(_messages.Message): - """[Optional] The struct field values, in order of the struct type's + r"""[Optional] The struct field values, in order of the struct type's declaration. Messages: @@ -2133,7 +2133,7 @@ class StructValuesValue(_messages.Message): """ class AdditionalProperty(_messages.Message): - """An additional property for a StructValuesValue object. + r"""An additional property for a StructValuesValue object. Fields: key: Name of the additional property. @@ -2151,7 +2151,7 @@ class AdditionalProperty(_messages.Message): class QueryRequest(_messages.Message): - """A QueryRequest object. + r"""A QueryRequest object. Fields: defaultDataset: [Optional] Specifies the default datasetId and projectId @@ -2213,7 +2213,7 @@ class QueryRequest(_messages.Message): class QueryResponse(_messages.Message): - """A QueryResponse object. + r"""A QueryResponse object. Fields: cacheHit: Whether the query result was fetched from the query cache. @@ -2261,7 +2261,7 @@ class QueryResponse(_messages.Message): class QueryTimelineSample(_messages.Message): - """A QueryTimelineSample object. + r"""A QueryTimelineSample object. Fields: activeUnits: Total number of units currently being processed by workers. @@ -2282,7 +2282,7 @@ class QueryTimelineSample(_messages.Message): class RangePartitioning(_messages.Message): - """A RangePartitioning object. + r"""A RangePartitioning object. Messages: RangeValue: [TrustedTester] [Required] Defines the ranges for range @@ -2297,7 +2297,7 @@ class RangePartitioning(_messages.Message): """ class RangeValue(_messages.Message): - """[TrustedTester] [Required] Defines the ranges for range partitioning. + r"""[TrustedTester] [Required] Defines the ranges for range partitioning. Fields: end: [TrustedTester] [Required] The end of range partitioning, @@ -2316,7 +2316,7 @@ class RangeValue(_messages.Message): class StandardQueryParameters(_messages.Message): - """Query parameters accepted by all methods. + r"""Query parameters accepted by all methods. Enums: AltValueValuesEnum: Data format for the response. @@ -2337,7 +2337,7 @@ class StandardQueryParameters(_messages.Message): """ class AltValueValuesEnum(_messages.Enum): - """Data format for the response. + r"""Data format for the response. Values: json: Responses with Content-Type of application/json @@ -2355,7 +2355,7 @@ class AltValueValuesEnum(_messages.Enum): class Streamingbuffer(_messages.Message): - """A Streamingbuffer object. + r"""A Streamingbuffer object. Fields: estimatedBytes: [Output-only] A lower-bound estimate of the number of @@ -2373,7 +2373,7 @@ class Streamingbuffer(_messages.Message): class Table(_messages.Message): - """A Table object. + r"""A Table object. Messages: LabelsValue: The labels associated with this table. You can use these to @@ -2459,7 +2459,7 @@ class Table(_messages.Message): @encoding.MapUnrecognizedFields('additionalProperties') class LabelsValue(_messages.Message): - """The labels associated with this table. You can use these to organize + r"""The labels associated with this table. You can use these to organize and group your tables. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values @@ -2474,7 +2474,7 @@ class LabelsValue(_messages.Message): """ class AdditionalProperty(_messages.Message): - """An additional property for a LabelsValue object. + r"""An additional property for a LabelsValue object. Fields: key: Name of the additional property. @@ -2517,7 +2517,7 @@ class AdditionalProperty(_messages.Message): class TableCell(_messages.Message): - """A TableCell object. + r"""A TableCell object. Fields: v: A extra_types.JsonValue attribute. @@ -2527,7 +2527,7 @@ class TableCell(_messages.Message): class TableDataInsertAllRequest(_messages.Message): - """A TableDataInsertAllRequest object. + r"""A TableDataInsertAllRequest object. Messages: RowsValueListEntry: A RowsValueListEntry object. @@ -2550,7 +2550,7 @@ class TableDataInsertAllRequest(_messages.Message): """ class RowsValueListEntry(_messages.Message): - """A RowsValueListEntry object. + r"""A RowsValueListEntry object. Fields: insertId: [Optional] A unique ID for each row. BigQuery uses this @@ -2571,7 +2571,7 @@ class RowsValueListEntry(_messages.Message): class TableDataInsertAllResponse(_messages.Message): - """A TableDataInsertAllResponse object. + r"""A TableDataInsertAllResponse object. Messages: InsertErrorsValueListEntry: A InsertErrorsValueListEntry object. @@ -2582,7 +2582,7 @@ class TableDataInsertAllResponse(_messages.Message): """ class InsertErrorsValueListEntry(_messages.Message): - """A InsertErrorsValueListEntry object. + r"""A InsertErrorsValueListEntry object. Fields: errors: Error information for the row indicated by the index property. @@ -2597,7 +2597,7 @@ class InsertErrorsValueListEntry(_messages.Message): class TableDataList(_messages.Message): - """A TableDataList object. + r"""A TableDataList object. Fields: etag: A hash of this page of results. @@ -2617,9 +2617,15 @@ class TableDataList(_messages.Message): class TableFieldSchema(_messages.Message): - """A TableFieldSchema object. + r"""A TableFieldSchema object. + + Messages: + CategoriesValue: [Optional] The categories attached to this field, used + for field-level access control. Fields: + categories: [Optional] The categories attached to this field, used for + field-level access control. description: [Optional] The field description. The maximum length is 1,024 characters. fields: [Optional] Describes the nested schema fields if the type property @@ -2636,15 +2642,28 @@ class TableFieldSchema(_messages.Message): STRUCT (same as RECORD). """ - description = _messages.StringField(1) - fields = _messages.MessageField('TableFieldSchema', 2, repeated=True) - mode = _messages.StringField(3) - name = _messages.StringField(4) - type = _messages.StringField(5) + class CategoriesValue(_messages.Message): + r"""[Optional] The categories attached to this field, used for field-level + access control. + + Fields: + names: A list of category resource names. For example, + "projects/1/taxonomies/2/categories/3". At most 5 categories are + allowed. + """ + + names = _messages.StringField(1, repeated=True) + + categories = _messages.MessageField('CategoriesValue', 1) + description = _messages.StringField(2) + fields = _messages.MessageField('TableFieldSchema', 3, repeated=True) + mode = _messages.StringField(4) + name = _messages.StringField(5) + type = _messages.StringField(6) class TableList(_messages.Message): - """A TableList object. + r"""A TableList object. Messages: TablesValueListEntry: A TablesValueListEntry object. @@ -2658,7 +2677,7 @@ class TableList(_messages.Message): """ class TablesValueListEntry(_messages.Message): - """A TablesValueListEntry object. + r"""A TablesValueListEntry object. Messages: LabelsValue: The labels associated with this table. You can use these to @@ -2688,7 +2707,7 @@ class TablesValueListEntry(_messages.Message): @encoding.MapUnrecognizedFields('additionalProperties') class LabelsValue(_messages.Message): - """The labels associated with this table. You can use these to organize + r"""The labels associated with this table. You can use these to organize and group your tables. Messages: @@ -2699,7 +2718,7 @@ class LabelsValue(_messages.Message): """ class AdditionalProperty(_messages.Message): - """An additional property for a LabelsValue object. + r"""An additional property for a LabelsValue object. Fields: key: Name of the additional property. @@ -2712,7 +2731,7 @@ class AdditionalProperty(_messages.Message): additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) class ViewValue(_messages.Message): - """Additional details for a view. + r"""Additional details for a view. Fields: useLegacySql: True if view is defined in legacy SQL dialect, false if @@ -2741,7 +2760,7 @@ class ViewValue(_messages.Message): class TableReference(_messages.Message): - """A TableReference object. + r"""A TableReference object. Fields: datasetId: [Required] The ID of the dataset containing this table. @@ -2757,7 +2776,7 @@ class TableReference(_messages.Message): class TableRow(_messages.Message): - """A TableRow object. + r"""A TableRow object. Fields: f: Represents a single row in the result set, consisting of one or more @@ -2768,7 +2787,7 @@ class TableRow(_messages.Message): class TableSchema(_messages.Message): - """A TableSchema object. + r"""A TableSchema object. Fields: fields: Describes the fields in a table. @@ -2778,7 +2797,7 @@ class TableSchema(_messages.Message): class TimePartitioning(_messages.Message): - """A TimePartitioning object. + r"""A TimePartitioning object. Fields: expirationMs: [Optional] Number of milliseconds for which to keep the @@ -2801,7 +2820,7 @@ class TimePartitioning(_messages.Message): class TrainingRun(_messages.Message): - """A TrainingRun object. + r"""A TrainingRun object. Messages: TrainingOptionsValue: [Output-only, Beta] Training options used by this @@ -2828,7 +2847,7 @@ class TrainingRun(_messages.Message): """ class TrainingOptionsValue(_messages.Message): - """[Output-only, Beta] Training options used by this training run. These + r"""[Output-only, Beta] Training options used by this training run. These options are mutable for subsequent training runs. Default values are explicitly stored for options not specified in the input query of the first training run. For subsequent training runs, any option not @@ -2864,7 +2883,7 @@ class TrainingOptionsValue(_messages.Message): class UserDefinedFunctionResource(_messages.Message): - """A UserDefinedFunctionResource object. + r"""A UserDefinedFunctionResource object. Fields: inlineCode: [Pick one] An inline resource that contains code for a user- @@ -2879,7 +2898,7 @@ class UserDefinedFunctionResource(_messages.Message): class ViewDefinition(_messages.Message): - """A ViewDefinition object. + r"""A ViewDefinition object. Fields: query: [Required] A query that BigQuery executes when the view is From cd0a37920bda08a1fcaf428e1f8b40114af47054 Mon Sep 17 00:00:00 2001 From: Valentyn Tymofieiev Date: Mon, 4 Feb 2019 19:01:09 +0000 Subject: [PATCH 2/2] Set response encoding for BigQuery APIs to 'utf-8' on Python3 --- sdks/python/apache_beam/io/gcp/bigquery_tools.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdks/python/apache_beam/io/gcp/bigquery_tools.py b/sdks/python/apache_beam/io/gcp/bigquery_tools.py index 97eff73749864..16016d86ee997 100644 --- a/sdks/python/apache_beam/io/gcp/bigquery_tools.py +++ b/sdks/python/apache_beam/io/gcp/bigquery_tools.py @@ -30,6 +30,7 @@ import json import logging import re +import sys import time import uuid from builtins import object @@ -177,7 +178,8 @@ class BigQueryWrapper(object): def __init__(self, client=None): self.client = client or bigquery.BigqueryV2( http=get_new_http(), - credentials=auth.get_service_credentials()) + credentials=auth.get_service_credentials(), + response_encoding=None if sys.version_info[0] < 3 else 'utf8') self._unique_row_id = 0 # For testing scenarios where we pass in a client we do not want a # randomized prefix for row IDs.