Skip to content

Commit

Permalink
Merge pull request #186 from Teradata/MT255026_IDE-24569
Browse files Browse the repository at this point in the history
enabling browser option for logmech
  • Loading branch information
tallamohan authored Aug 28, 2024
2 parents 21e656d + e630802 commit 9f4ffe7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ At a minimum, you need to specify `host`, `user`, `password`, `schema` (database

### Logmech

The logon mechanism for Teradata jobs that dbt executes can be configured with the `logmech` configuration in your Teradata profile. The `logmech` field can be set to: `TD2`, `LDAP`, `KRB5`, `TDNEGO`. For more information on authentication options, go to [Teradata Vantage authentication documentation](https://docs.teradata.com/r/8Mw0Cvnkhv1mk1LEFcFLpw/0Ev5SyB6_7ZVHywTP7rHkQ).
The logon mechanism for Teradata jobs that dbt executes can be configured with the `logmech` configuration in your Teradata profile. The `logmech` field can be set to: `TD2`, `LDAP`, `BROWSER`, `KRB5`, `TDNEGO`. For more information on authentication options, go to [Teradata Vantage authentication documentation](https://docs.teradata.com/r/8Mw0Cvnkhv1mk1LEFcFLpw/0Ev5SyB6_7ZVHywTP7rHkQ).

> For the initial BROWSER authentication, the browser opens as expected, asking for the credentials. However, for every subsequent connection, a new browser tab opens, displaying the message 'TERADATA BROWSER AUTHENTICATION COMPLETED,' despite using an existing BROWSER session silently. This is the default behavior of the teradatasql driver, and there is no way to avoid this at the present time.

```yaml
my-teradata-db-profile:
Expand Down
16 changes: 11 additions & 5 deletions dbt/adapters/teradata/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ class TeradataCredentials(Credentials):
}

def __post_init__(self):
if self.username is None:
raise dbt_common.exceptions.DbtRuntimeError("Must specify `user` in profile")
elif self.password is None:
raise dbt_common.exceptions.DbtRuntimeError("Must specify `password` in profile")
elif self.schema is None:
if self.logmech is not None and self.logmech.lower() == "browser":
# When logmech is "browser", username and password should not be provided.
if self.username is not None or self.password is not None:
raise dbt_common.exceptions.DbtRuntimeError(
"Username and password should not be specified when logmech is 'browser'")
else:
if self.username is None:
raise dbt_common.exceptions.DbtRuntimeError("Must specify `user` in profile")
elif self.password is None:
raise dbt_common.exceptions.DbtRuntimeError("Must specify `password` in profile")
if self.schema is None:
raise dbt_common.exceptions.DbtRuntimeError("Must specify `schema` in profile")
# teradata classifies database and schema as the same thing
if (
Expand Down

0 comments on commit 9f4ffe7

Please sign in to comment.