Repository: PrefectHQ/prefect

Issue:
BigQueryLoadFile does not return the response from load_table_from_file
## Description
<!-- A clear description of the bug -->
For BigQueryLoadFile, the documentation suggests it:
```
Returns:
            - the response from `load_table_from_file`
```
In the code, however, the google.cloud.bigquery.job.LoadJob is not returned:

```
        try:
            with open(file, "rb") as file_obj:
                load_job = client.load_table_from_file(
                    file_obj,
                    table_ref,
                    rewind,
                    size,
                    num_retries,
                    job_config=job_config,
                )
        except IOError:
            raise IOError(f"Can't open and read from {path.as_posix()}.")

        load_job.result()  # block until job is finished
        # END OF FUNCTION
```

## Expected Behavior
<!-- What did you expect to happen instead? -->

I expected the the load_job object to be returned.  I usually inspect this object to identify errors, output_rows, etc.


## Reproduction
<!-- A minimal example that exhibits the behavior. -->

```
bq_load_file = gcp.BigQueryLoadFile()

load_job = bq_load_file(
        my_gcs_path,
        dataset_id=my_dataset,
        table=my_table,
        project=my_project,
        schema=my_schema,
        create_disposition=google.cloud.bigquery.job.CreateDisposition.CREATE_NEVER,
        source_format=google.cloud.bigquery.job.SourceFormat.NEWLINE_DELIMITED_JSON,
        write_disposition=google.cloud.bigquery.job.WriteDisposition.WRITE_APPEND,
    )

```


## Environment
<!-- Any additional information about your environment

Optionally run `prefect diagnostics` from the command line and paste the information here. -->



Discussion:
Thanks for opening @fwinokur! That community task could definitely be updated to return that information 🙂 
I will take a crack at it!  I noticed this task is also missing from the [GCP API Reference](https://docs.prefect.io/api/latest/tasks/gcp.html) so can add it there as well.

Resolving patch:
diff --git a/src/prefect/tasks/gcp/bigquery.py b/src/prefect/tasks/gcp/bigquery.py
--- a/src/prefect/tasks/gcp/bigquery.py
+++ b/src/prefect/tasks/gcp/bigquery.py
@@ -362,7 +362,7 @@ def run(
             - ValueError: if the load job results in an error
 
         Returns:
-            - the response from `load_table_from_uri`
+            - google.cloud.bigquery.job.LoadJob: the response from `load_table_from_uri`
         """
         # check for any argument inconsistencies
         if dataset_id is None or table is None:
@@ -382,6 +382,8 @@ def run(
         load_job = client.load_table_from_uri(uri, table_ref, job_config=job_config)
         load_job.result()  # block until job is finished
 
+        return load_job
+
 
 class BigQueryLoadFile(Task):
     """
@@ -397,6 +399,8 @@ class BigQueryLoadFile(Task):
         - size (int, optional):  the number of bytes to read from the file handle. If size is
             None or large, resumable upload will be used. Otherwise, multipart upload will be
             used.
+        - num_retries (int, optional): the number of max retries for loading the bigquery table from
+            file. Defaults to `6`
         - dataset_id (str, optional): the id of a destination dataset to write the records to
         - table (str, optional): the name of a destination table to write the records to
         - project (str, optional): the project to initialize the BigQuery Client with; if not
@@ -468,6 +472,8 @@ def run(
             - size (int, optional):  the number of bytes to read from the file handle. If size
                 is None or large, resumable upload will be used. Otherwise, multipart upload
                 will be used.
+            - num_retries (int, optional): the number of max retries for loading the bigquery table from
+                file. Defaults to `6`
             - dataset_id (str, optional): the id of a destination dataset to write the records
                 to; if not provided here, will default to the one provided at initialization
             - table (str, optional): the name of a destination table to write the records to;
@@ -490,7 +496,7 @@ def run(
             - ValueError: if the load job results in an error
 
         Returns:
-            - the response from `load_table_from_file`
+            - google.cloud.bigquery.job.LoadJob: the response from `load_table_from_file`
         """
         # check for any argument inconsistencies
         if dataset_id is None or table is None:
@@ -530,6 +536,8 @@ def run(
 
         load_job.result()  # block until job is finished
 
+        return load_job
+
 
 class CreateBigQueryTable(Task):
     """


Test patch: