Repository: dbt-labs/dbt-core

Issue:
Regression: ignore timeout for BigQuery models
### Describe the bug
[This PR](https://github.com/fishtown-analytics/dbt/pull/1963/files) added support for BigQuery retries. Two things to note here:
1. It also made the `timeout_seconds` value significant for models, which it should not have done
2. it prints invalid log lines to stdout, eg:
```
Not Retrying after %s previous attempts. Error: %s
```

### Steps To Reproduce
1. set the `timeout_seconds` value for a bq profile to `1`
2. execute a `dbt run`

### Expected behavior
- Timeouts should not be significant for regular models (only ingestion-time partitioned models)
- The log lines present should render actual values
- The log lines should be logged at the debug level

### Screenshots and log output
<img width="983" alt="Screen Shot 2019-12-18 at 3 12 39 PM" src="https://user-images.githubusercontent.com/1541139/71119740-e0534f80-21a8-11ea-899e-23b2208a9d2a.png">

### System information
**Which database are you using dbt with?**
- bigquery


**The output of `dbt --version`:**
```
0.15.1 HEAD
```


Discussion:

Resolving patch:
diff --git a/plugins/bigquery/dbt/adapters/bigquery/connections.py b/plugins/bigquery/dbt/adapters/bigquery/connections.py
--- a/plugins/bigquery/dbt/adapters/bigquery/connections.py
+++ b/plugins/bigquery/dbt/adapters/bigquery/connections.py
@@ -176,9 +176,12 @@ def get_timeout(cls, conn):
         return credentials.timeout_seconds
 
     @classmethod
-    def get_retries(cls, conn):
+    def get_retries(cls, conn) -> int:
         credentials = conn.credentials
-        return credentials.retries
+        if credentials.retries is not None:
+            return credentials.retries
+        else:
+            return 1
 
     @classmethod
     def get_table_from_response(cls, resp):
@@ -270,8 +273,11 @@ def create_table(self, database, schema, table_name, sql):
         job_params = {'destination': table_ref,
                       'write_disposition': 'WRITE_TRUNCATE'}
 
+        timeout = self.get_timeout(conn)
+
         def fn():
-            return self._query_and_results(client, sql, conn, job_params)
+            return self._query_and_results(client, sql, conn, job_params,
+                                           timeout=timeout)
         self._retry_and_handle(msg=sql, conn=conn, fn=fn)
 
     def create_date_partitioned_table(self, database, schema, table_name):
@@ -317,12 +323,12 @@ def fn():
             return client.create_dataset(dataset, exists_ok=True)
         self._retry_and_handle(msg='create dataset', conn=conn, fn=fn)
 
-    def _query_and_results(self, client, sql, conn, job_params):
+    def _query_and_results(self, client, sql, conn, job_params, timeout=None):
         """Query the client and wait for 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(sql, job_config=job_config)
-        iterator = query_job.result(timeout=self.get_timeout(conn))
+        iterator = query_job.result(timeout=timeout)
 
         return query_job, iterator
 
@@ -354,13 +360,13 @@ def count_error(self, error):
             return False  # Don't log
         self.error_count += 1
         if _is_retryable(error) and self.error_count <= self.retries:
-            logger.warning(
-                'Retry attempt %s of %s after error: %s',
+            logger.debug(
+                'Retry attempt {} of {} after error: {}',
                 self.error_count, self.retries, repr(error))
             return True
         else:
-            logger.warning(
-                'Not Retrying after %s previous attempts. Error: %s',
+            logger.debug(
+                'Not Retrying after {} previous attempts. Error: {}',
                 self.error_count - 1, repr(error))
             return False
 


Test patch: