diff --git a/.changes/unreleased/Features-20230505-184427.yaml b/.changes/unreleased/Features-20230505-184427.yaml new file mode 100644 index 000000000..1267d02ab --- /dev/null +++ b/.changes/unreleased/Features-20230505-184427.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Move the BQ Job link after the job submission instead of job done +time: 2023-05-05T18:44:27.939038+02:00 +custom: + Author: Kayrnt + Issue: "696" diff --git a/dbt/adapters/bigquery/connections.py b/dbt/adapters/bigquery/connections.py index f726481e7..109e63c64 100644 --- a/dbt/adapters/bigquery/connections.py +++ b/dbt/adapters/bigquery/connections.py @@ -534,9 +534,6 @@ def execute( else: message = f"{code}" - if location is not None and job_id is not None and project_id is not None: - logger.debug(self._bq_job_link(location, project_id, job_id)) - response = BigQueryAdapterResponse( # type: ignore[call-arg] _message=message, rows_affected=num_rows, @@ -663,6 +660,16 @@ def _query_and_results( # Cannot reuse job_config if destination is set and ddl is used job_config = google.cloud.bigquery.QueryJobConfig(**job_params) query_job = client.query(query=sql, job_config=job_config, timeout=job_creation_timeout) + + if ( + query_job.location is not None + and query_job.job_id is not None + and query_job.project is not None + ): + logger.debug( + self._bq_job_link(query_job.location, query_job.project, query_job.job_id) + ) + iterator = query_job.result(max_results=limit, timeout=job_execution_timeout) return query_job, iterator