Skip to content

Commit 38080c8

Browse files
authored
Update external_config docstrings to google style and fixes typos (googleapis#5713)
1 parent cac541c commit 38080c8

1 file changed

Lines changed: 105 additions & 84 deletions

File tree

bigquery/google/cloud/bigquery/external_config.py

Lines changed: 105 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131

3232
class ExternalSourceFormat(object):
33-
"""The format for external data files..
33+
"""The format for external data files.
3434
3535
Note that the set of allowed values for external data sources is different
3636
than the set used for loading data (see
@@ -157,21 +157,26 @@ def type_(self, value):
157157
def to_api_repr(self):
158158
"""Build an API representation of this object.
159159
160-
:rtype: dict
161-
:returns: A dictionary in the format used by the BigQuery API.
160+
Returns:
161+
Dict[str, Any]:
162+
A dictionary in the format used by the BigQuery API.
162163
"""
163164
return copy.deepcopy(self._properties)
164165

165166
@classmethod
166167
def from_api_repr(cls, resource):
167-
"""Factory: construct a BigtableColumn given its API representation
168+
"""Factory: construct a :class:`~.external_config.BigtableColumn`
169+
instance given its API representation.
168170
169-
:type resource: dict
170-
:param resource:
171-
A column in the same representation as is returned from the API.
171+
Args:
172+
resource (Dict[str, Any]):
173+
Definition of a :class:`~.external_config.BigtableColumn`
174+
instance in the same representation as is returned from the
175+
API.
172176
173-
:rtype: :class:`~google.cloud.bigquery.BigtableColumn`
174-
:returns: Configuration parsed from ``resource``.
177+
Returns:
178+
:class:`~.external_config.BigtableColumn`:
179+
Configuration parsed from ``resource``.
175180
"""
176181
config = cls()
177182
config._properties = copy.deepcopy(resource)
@@ -243,8 +248,8 @@ def type_(self, value):
243248

244249
@property
245250
def columns(self):
246-
"""List[google.cloud.bigquery.external_config.BigtableColumn]: Lists of
247-
columns that should be exposed as individual fields
251+
"""List[:class:`~.external_config.BigtableColumn`]: Lists of columns
252+
that should be exposed as individual fields.
248253
249254
See
250255
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies.columns
@@ -260,33 +265,35 @@ def columns(self, value):
260265
def to_api_repr(self):
261266
"""Build an API representation of this object.
262267
263-
:rtype: dict
264-
:returns: A dictionary in the format used by the BigQuery API.
268+
Returns:
269+
Dict[str, Any]:
270+
A dictionary in the format used by the BigQuery API.
265271
"""
266272
return copy.deepcopy(self._properties)
267273

268274
@classmethod
269275
def from_api_repr(cls, resource):
270-
"""Factory: construct a BigtableColumnFamily given its
271-
API representation
276+
"""Factory: construct a :class:`~.external_config.BigtableColumnFamily`
277+
instance given its API representation.
272278
273-
:type resource: dict
274-
:param resource:
275-
A column family in the same representation as is returned
276-
from the API.
279+
Args:
280+
resource (Dict[str, Any]):
281+
Definition of a :class:`~.external_config.BigtableColumnFamily`
282+
instance in the same representation as is returned from the
283+
API.
277284
278-
:rtype:
279-
:class:`~google.cloud.bigquery.external_config.BigtableColumnFamily`
280-
:returns: Configuration parsed from ``resource``.
285+
Returns:
286+
:class:`~.external_config.BigtableColumnFamily`:
287+
Configuration parsed from ``resource``.
281288
"""
282289
config = cls()
283290
config._properties = copy.deepcopy(resource)
284291
return config
285292

286293

287294
class BigtableOptions(object):
288-
"""Options that describe how to treat Bigtable tables
289-
as BigQuery tables."""
295+
"""Options that describe how to treat Bigtable tables as BigQuery tables.
296+
"""
290297

291298
_SOURCE_FORMAT = 'BIGTABLE'
292299
_RESOURCE_NAME = 'bigtableOptions'
@@ -296,8 +303,8 @@ def __init__(self):
296303

297304
@property
298305
def ignore_unspecified_column_families(self):
299-
"""bool: If `True`, ignore columns not specified in columnFamilies
300-
list. Defaults to `False`.
306+
"""bool: If :data:`True`, ignore columns not specified in
307+
:attr:`column_families` list. Defaults to :data:`False`.
301308
302309
See
303310
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).bigtableOptions.ignoreUnspecifiedColumnFamilies
@@ -311,8 +318,8 @@ def ignore_unspecified_column_families(self, value):
311318

312319
@property
313320
def read_rowkey_as_string(self):
314-
"""bool: If `True`, rowkey column families will be read and converted
315-
to string. Defaults to `False`.
321+
"""bool: If :data:`True`, rowkey column families will be read and
322+
converted to string. Defaults to :data:`False`.
316323
317324
See
318325
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).bigtableOptions.readRowkeyAsString
@@ -326,9 +333,8 @@ def read_rowkey_as_string(self, value):
326333

327334
@property
328335
def column_families(self):
329-
"""List[google.cloud.bigquery.external_config.BigtableColumnFamily]:
330-
List of column families to expose in the table schema along with their
331-
types.
336+
"""List[:class:`~.external_config.BigtableColumnFamily`]: List of
337+
column families to expose in the table schema along with their types.
332338
333339
See
334340
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies
@@ -344,23 +350,26 @@ def column_families(self, value):
344350
def to_api_repr(self):
345351
"""Build an API representation of this object.
346352
347-
:rtype: dict
348-
:returns: A dictionary in the format used by the BigQuery API.
353+
Returns:
354+
Dict[str, Any]:
355+
A dictionary in the format used by the BigQuery API.
349356
"""
350357
return copy.deepcopy(self._properties)
351358

352359
@classmethod
353360
def from_api_repr(cls, resource):
354-
"""Factory: construct a BigtableOptions given its API representation
361+
"""Factory: construct a :class:`~.external_config.BigtableOptions`
362+
instance given its API representation.
355363
356-
:type resource: dict
357-
:param resource:
358-
A BigtableOptions in the same representation as is returned
359-
from the API.
364+
Args:
365+
resource (Dict[str, Any]):
366+
Definition of a :class:`~.external_config.BigtableOptions`
367+
instance in the same representation as is returned from the
368+
API.
360369
361-
:rtype:
362-
:class:`~google.cloud.bigquery.external_config.BigtableOptions`
363-
:returns: Configuration parsed from ``resource``.
370+
Returns:
371+
:class:`~.external_config.BigtableOptions`:
372+
Configuration parsed from ``resource``.
364373
"""
365374
config = cls()
366375
config._properties = copy.deepcopy(resource)
@@ -378,8 +387,8 @@ def __init__(self):
378387

379388
@property
380389
def allow_jagged_rows(self):
381-
"""bool: If `True`, BigQuery treats missing trailing columns as null
382-
values. Defaults to `False`.
390+
"""bool: If :data:`True`, BigQuery treats missing trailing columns as
391+
null values. Defaults to :data:`False`.
383392
384393
See
385394
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).csvOptions.allowJaggedRows
@@ -393,8 +402,8 @@ def allow_jagged_rows(self, value):
393402

394403
@property
395404
def allow_quoted_newlines(self):
396-
"""bool: If `True`, quoted data sections that contain newline
397-
characters in a CSV file are allowed. Defaults to `False`.
405+
"""bool: If :data:`True`, quoted data sections that contain newline
406+
characters in a CSV file are allowed. Defaults to :data:`False`.
398407
399408
See
400409
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).csvOptions.allowQuotedNewlines
@@ -422,7 +431,7 @@ def encoding(self, value):
422431

423432
@property
424433
def field_delimiter(self):
425-
"""str: The separator for fields in a CSV file. Defaults a comma (',').
434+
"""str: The separator for fields in a CSV file. Defaults to comma (',').
426435
427436
See
428437
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).csvOptions.fieldDelimiter
@@ -465,22 +474,26 @@ def skip_leading_rows(self, value):
465474
def to_api_repr(self):
466475
"""Build an API representation of this object.
467476
468-
:rtype: dict
469-
:returns: A dictionary in the format used by the BigQuery API.
477+
Returns:
478+
Dict[str, Any]:
479+
A dictionary in the format used by the BigQuery API.
470480
"""
471481
return copy.deepcopy(self._properties)
472482

473483
@classmethod
474484
def from_api_repr(cls, resource):
475-
"""Factory: construct a CSVOptions given its API representation
485+
"""Factory: construct a :class:`~.external_config.CSVOptions` instance
486+
given its API representation.
476487
477-
:type resource: dict
478-
:param resource:
479-
A CSVOptions in the same representation as is
480-
returned from the API.
488+
Args:
489+
resource (Dict[str, Any]):
490+
Definition of a :class:`~.external_config.CSVOptions`
491+
instance in the same representation as is returned from the
492+
API.
481493
482-
:rtype: :class:`~google.cloud.bigquery.external_config.CSVOptions`
483-
:returns: Configuration parsed from ``resource``.
494+
Returns:
495+
:class:`~.external_config.CSVOptions`:
496+
Configuration parsed from ``resource``.
484497
"""
485498
config = cls()
486499
config._properties = copy.deepcopy(resource)
@@ -514,23 +527,26 @@ def skip_leading_rows(self, value):
514527
def to_api_repr(self):
515528
"""Build an API representation of this object.
516529
517-
:rtype: dict
518-
:returns: A dictionary in the format used by the BigQuery API.
530+
Returns:
531+
Dict[str, Any]:
532+
A dictionary in the format used by the BigQuery API.
519533
"""
520534
return copy.deepcopy(self._properties)
521535

522536
@classmethod
523537
def from_api_repr(cls, resource):
524-
"""Factory: construct a GoogleSheetsOptions given its API representation
538+
"""Factory: construct a :class:`~.external_config.GoogleSheetsOptions`
539+
instance given its API representation.
525540
526-
:type resource: dict
527-
:param resource:
528-
An GoogleSheetsOptions in the same representation as is
529-
returned from the API.
541+
Args:
542+
resource (Dict[str, Any]):
543+
Definition of a :class:`~.external_config.GoogleSheetsOptions`
544+
instance in the same representation as is returned from the
545+
API.
530546
531-
:rtype:
532-
:class:`~google.cloud.bigquery.external_config.GoogleSheetsOptions`
533-
:returns: Configuration parsed from ``resource``.
547+
Returns:
548+
:class:`~.external_config.GoogleSheetsOptions`:
549+
Configuration parsed from ``resource``.
534550
"""
535551
config = cls()
536552
config._properties = copy.deepcopy(resource)
@@ -544,7 +560,7 @@ class ExternalConfig(object):
544560
"""Description of an external data source.
545561
546562
Args:
547-
source_format :class:`ExternalSourceFormat`:
563+
source_format (:class:`~.external_config.ExternalSourceFormat`):
548564
See :attr:`source_format`.
549565
"""
550566

@@ -558,7 +574,8 @@ def __init__(self, source_format):
558574

559575
@property
560576
def source_format(self):
561-
""":class:`ExternalSourceFormat`: Format of external source.
577+
""":class:`~.external_config.ExternalSourceFormat`:
578+
Format of external source.
562579
563580
See
564581
https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#externalDataConfiguration.sourceFormat
@@ -567,12 +584,12 @@ def source_format(self):
567584

568585
@property
569586
def options(self):
570-
"""Source-specific options."""
587+
"""Dict[str, Any]: Source-specific options."""
571588
return self._options
572589

573590
@property
574591
def autodetect(self):
575-
"""bool: If `True`, try to detect schema and format options
592+
"""bool: If :data:`True`, try to detect schema and format options
576593
automatically.
577594
578595
See
@@ -601,8 +618,8 @@ def compression(self, value):
601618

602619
@property
603620
def ignore_unknown_values(self):
604-
"""bool: If `True`, extra values that are not represented in the table
605-
schema are ignored. Defaults to `False`.
621+
"""bool: If :data:`True`, extra values that are not represented in the
622+
table schema are ignored. Defaults to :data:`False`.
606623
607624
See
608625
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).ignoreUnknownValues
@@ -645,8 +662,8 @@ def source_uris(self, value):
645662

646663
@property
647664
def schema(self):
648-
"""List[google.cloud.bigquery.schema.SchemaField]: The schema for the
649-
data.
665+
"""List[:class:`~google.cloud.bigquery.schema.SchemaField`]: The schema
666+
for the data.
650667
651668
See
652669
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).schema
@@ -666,8 +683,9 @@ def schema(self, value):
666683
def to_api_repr(self):
667684
"""Build an API representation of this object.
668685
669-
:rtype: dict
670-
:returns: A dictionary in the format used by the BigQuery API.
686+
Returns:
687+
Dict[str, Any]:
688+
A dictionary in the format used by the BigQuery API.
671689
"""
672690
config = copy.deepcopy(self._properties)
673691
if self.options is not None:
@@ -678,15 +696,18 @@ def to_api_repr(self):
678696

679697
@classmethod
680698
def from_api_repr(cls, resource):
681-
"""Factory: construct a CSVOptions given its API representation
682-
683-
:type resource: dict
684-
:param resource:
685-
An extract job configuration in the same representation as is
686-
returned from the API.
687-
688-
:rtype: :class:`~google.cloud.bigquery.external_config.CSVOptions`
689-
:returns: Configuration parsed from ``resource``.
699+
"""Factory: construct an :class:`~.external_config.ExternalConfig`
700+
instance given its API representation.
701+
702+
Args:
703+
resource (Dict[str, Any]):
704+
Definition of an :class:`~.external_config.ExternalConfig`
705+
instance in the same representation as is returned from the
706+
API.
707+
708+
Returns:
709+
:class:`~.external_config.ExternalConfig`:
710+
Configuration parsed from ``resource``.
690711
"""
691712
config = cls(resource['sourceFormat'])
692713
for optcls in _OPTION_CLASSES:

0 commit comments

Comments
 (0)