diff --git a/dbt/adapters/sqlserver/sql_server_connection_manager.py b/dbt/adapters/sqlserver/sql_server_connection_manager.py index 510be205..f5ac8546 100644 --- a/dbt/adapters/sqlserver/sql_server_connection_manager.py +++ b/dbt/adapters/sqlserver/sql_server_connection_manager.py @@ -377,7 +377,9 @@ def connect(): con_str_concat, attrs_before=attrs_before, autocommit=True, + timeout=credentials.login_timeout, ) + handle.timeout = credentials.query_timeout logger.debug(f"Connected to db: {credentials.database}") return handle diff --git a/dbt/adapters/sqlserver/sql_server_credentials.py b/dbt/adapters/sqlserver/sql_server_credentials.py index 94e73cd0..90579213 100644 --- a/dbt/adapters/sqlserver/sql_server_credentials.py +++ b/dbt/adapters/sqlserver/sql_server_credentials.py @@ -22,6 +22,8 @@ class SQLServerCredentials(Credentials): trust_cert: Optional[bool] = False # default value in MS ODBC Driver 18 as well retries: int = 1 schema_authorization: Optional[str] = None + login_timeout: Optional[int] = None + query_timeout: Optional[int] = None _ALIASES = { "user": "UID", @@ -58,6 +60,8 @@ def _connection_keys(self): "encrypt", "trust_cert", "retries", + "login_timeout", + "query_timeout", ) @property