# Version: Airflow: apache-airflow-backport-providers-google==2020.11.13

## Problem 
The operator gcs to bigquery fails because it calls the method download with positional parameters in the wrong order. 
It calls in this way `gcs_hook.download(self.bucket, self.schema_object)`. See more in the [line](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py#L267)

The signature for the download is `gcs_hook.download(self, object_name, bucket_name)`. See more in the [line ](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/hooks/gcs.py#L259-L261)

## Solution

1.  Change the [gcs_to_bigquery](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py#L267) operator so it  calls the method download with the keyword parameters rather than positional.
2. Change the [gcs_to_bigquery](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py#L267) operator so it calls the method download with the right order of the parameters. 
3. Change the signature of download method in the [gcs_hook](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/hooks/gcs.py#L353-L361)  to be `def download(self, bucket_name, object_name, filename)` rather than `def dowload(self, object_name, bucket_name, filename)` 

I would prefer the option 3 because the method upload start with bucket_name see [line]( https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/hooks/gcs.py#L353-L361) and it makes sense to follow the same convention. Also most of the method in the gcs hook start with bucket name. 

Also in Airflow 1.10.12 the method download starts with bucket_name and it would make sense not to change the order of the parameters (even if it change the name of the parameters). See [here](https://airflow.apache.org/docs/stable/_api/airflow/contrib/hooks/gcs_hook/index.html#airflow.contrib.hooks.gcs_hook.GoogleCloudStorageHook.download)

## Issues Related
This issue is related with https://github.com/apache/airflow/issues/12335. It was closed but it was not fixed. I left a comments but there was not reply.
airflow/providers/google/cloud/transfers/gcs_to_bigquery.py
skip_leading_rows=self.skip_leading_rows,
                write_disposition=self.write_disposition,
                field_delimiter=self.field_delimiter,
                max_bad_records=self.max_bad_records,
                quote_character=self.quote_character,
                ignore_unknown_values=self.ignore_unknown_values,
                allow_quoted_newlines=self.allow_quoted_newlines,
                allow_jagged_rows=self.allow_jagged_rows,
                encoding=self.encoding,
                schema_update_options=self.schema_update_options,
                src_fmt_configs=self.src_fmt_configs,
                time_partitioning=self.time_partitioning,
                cluster_fields=self.cluster_fields,
                encryption_configuration=self.encryption_configuration,
            )
        if cursor.use_legacy_sql:
            escaped_table_name = f'[{self.destination_project_dataset_table}]'
        else:
            escaped_table_name = f'`{self.destination_project_dataset_table}`'
        if self.max_id_key:
            cursor.execute(f'SELECT MAX({self.max_id_key}) FROM {escaped_table_name}')
            row = cursor.fetchone()
            max_id = row[0] if row[0] else 0
            self.log.info(
                'Loaded BQ data with max %s.%s=%s',
                self.destination_project_dataset_table,
                self.max_id_key,
                max_id,
            )