Repository: dbt-athena/dbt-athena (python)

Issue:
Fix num_retries
## Context
When setting up num_retries=1 the queries are not retried, because in num_retries is in max_attempt.

Fix the issue changing https://github.com/dbt-athena/dbt-athena/blob/main/dbt/adapters/athena/connections.py#L178 to
`stop=stop_after_attempt(self._retry_config.attempt + 1)`

Doing so when the user uses num_retries=0 means we issue 1 attempt,
but when passing num_retries=1, 2 attempts are issued and so on num_retries=2, means 3 total attempts and 2 retries in total.

Pull request description:
fix: wrong num_retries counting the first run
Fixes #436 

# Description

<!--- Add a little description on what you plan to tackle with this PR -->
<!--- Add resolve #issue-number in case you resolve an open issue -->

## Models used to test - Optional
<!--- Add here the models that you use to test the changes -->

## Checklist

- [X] You followed [contributing section](https://github.com/dbt-athena/dbt-athena#contributing)
- [X] You kept your Pull Request small and focused on a single feature or bug fix.
- [X] You added unit testing when necessary
- [X] You added functional testing when necessary


Patch:
diff --git a/dbt/adapters/athena/connections.py b/dbt/adapters/athena/connections.py
index ce47706..d97b766 100644
--- a/dbt/adapters/athena/connections.py
+++ b/dbt/adapters/athena/connections.py
@@ -56,7 +56,7 @@ class AthenaCredentials(Credentials):
     poll_interval: float = 1.0
     debug_query_state: bool = False
     _ALIASES = {"catalog": "database"}
-    num_retries: Optional[int] = 5
+    num_retries: int = 5
     s3_data_dir: Optional[str] = None
     s3_data_naming: Optional[str] = "schema_table_unique"
     seed_s3_upload_args: Optional[Dict[str, Any]] = None
@@ -228,7 +228,7 @@ class AthenaConnectionManager(SQLConnectionManager):
                 poll_interval=creds.poll_interval,
                 session=get_boto3_session(connection),
                 retry_config=RetryConfig(
-                    attempt=creds.num_retries,
+                    attempt=creds.num_retries + 1,
                     exceptions=("ThrottlingException", "TooManyRequestsException", "InternalServerException"),
                 ),
                 config=get_boto3_config(),


Test patch:
diff --git a/tests/unit/test_adapter.py b/tests/unit/test_adapter.py
index aaef3d9..8a815b3 100644
--- a/tests/unit/test_adapter.py
+++ b/tests/unit/test_adapter.py
@@ -283,7 +283,7 @@ class TestAthenaAdapter:
         assert arguments["cursor_class"] == AthenaCursor
         assert isinstance(arguments["formatter"], AthenaParameterFormatter)
         assert arguments["poll_interval"] == 1.0
-        assert arguments["retry_config"].attempt == 5
+        assert arguments["retry_config"].attempt == 6
         assert arguments["retry_config"].exceptions == (
             "ThrottlingException",
             "TooManyRequestsException",