Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bigquery/samples/export_data_to_cloud_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# [START export_table]
def export_table(service, cloud_storage_path,
projectId, datasetId, tableId,
export_format="CSV",
num_retries=5):
"""
Starts an export job
Expand All @@ -30,6 +31,8 @@ def export_table(service, cloud_storage_path,
cloud_storage_path: fully qualified
path to a Google Cloud Storage location,
e.g. gs://mybucket/myfolder/
export_format: format to export in;
"CSV", "NEWLINE_DELIMITED_JSON", or "AVRO".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit
I think it is normal to indent the continuation in the argument section. Also capitalize the first letter of each section and add period instead of comma at the end of the section.

def export_table(service, cloud_storage_path, projectId, datasetId, tableId,
                 num_retries=5):
    """
    Starts an export job

    Args:
        service: Initialized and authorized bigquery google-api-client object.
        cloud_storage_path: Fully qualified path to a Google Cloud Storage
            location (e.g. gs://mybucket/myfolder/).

    Returns: An extract job resource representing the job. See
        https://cloud.google.com/bigquery/docs/reference/v2/jobs
    """
    pass


Returns: an extract job resource representing the
job, see https://cloud.google.com/bigquery/docs/reference/v2/jobs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring still has wrong indentations.

It should be as follows:

def export_table(service, cloud_storage_path,
                 projectId, datasetId, tableId,
                 export_format="CSV",
                 num_retries=5):
    """
    Starts an export job.

    Args:
        service: Initialized and authorized bigquery
            google-api-client object.
        cloud_storage_path: Fully qualified
            path to a Google Cloud Storage location.
            e.g. gs://mybucket/myfolder/
        export_format: Format to export in;
            "CSV", "NEWLINE_DELIMITED_JSON", or "AVRO".

    Returns: An extract job resource representing the
        job, see https://cloud.google.com/bigquery/docs/reference/v2/jobs
    """
  • Use period at the end of the clause
  • Use capitalized first letter
  • Correct indentation (continuation line should have deeper indent, for example, the second line for the "service" argument should have deeper indentation)

Expand All @@ -49,6 +52,7 @@ def export_table(service, cloud_storage_path,
'tableId': tableId,
},
'destinationUris': [cloud_storage_path],
'destinationFormat': export_format
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add test for this option?

}
}
}
Expand Down