Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Issue339 ldap logmech #347

Merged
merged 7 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data_validation/cli_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
["port", "Teradata port to connect on"],
["user_name", "User used to connect"],
["password", "Password for supplied user"],
["logmech", "Log on mechanism"],
],
"Oracle": [
["host", "Desired Oracle host"],
Expand Down
3 changes: 2 additions & 1 deletion docs/connections.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ via `pip install teradatasql` if you have a license.
# Connection Details
"host": "127.0.0.1",
"port":1025,
"user_name":"my-user",
"logmech":"TD2",
"user-name":"my-user",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work since in the connection config JSON expects an underscore. For adding a connection via CLI, we expect a hyphen and the code in cli_tools manages that. Could you revert this change?

Instead, there is a bug in the connections documentation here that uses a flag with an underscore instead of a hyphen. We need to change that to --user-name.

"password":"my-password"
}
```
Expand Down
6 changes: 4 additions & 2 deletions third_party/ibis/ibis_teradata/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def verify(expr, params=None):


def connect(
host: str, user_name: str, password: str, port: Optional[int] = 1025
host: str, user_name: str, password: str, port: Optional[int] = 1025, logmech: Optional[str]='TD2'
) -> TeradataClient:
""" Create a TeradataClient for use with Ibis.
Parameters
Expand All @@ -49,11 +49,13 @@ def connect(
A Database username to connect with
password : str
Password for supplied username
logmech : Optional[str]
Logmech flag to select with (default. TD2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Can we update this to reflect the order of the parameters? (logmech after port)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep!

port : Optional[int]
The database port to connect to (default. 1025)
Returns
-------
TeradataClient
"""

return TeradataClient(host, user_name, password, port)
return TeradataClient(host, user_name, password, port, logmech)
3 changes: 2 additions & 1 deletion third_party/ibis/ibis_teradata/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class TeradataClient(SQLClient):
table_class = TeradataTable
dialect = compiler.TeradataDialect

def __init__(self, host, user_name, password, port=1025, use_no_lock_tables=False):
def __init__(self, host, user_name, password, port=1025, logmech='TD2', use_no_lock_tables=False):
"""Construct a TeradataClient.

Parameters
nehanene15 marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -85,6 +85,7 @@ def __init__(self, host, user_name, password, port=1025, use_no_lock_tables=Fals
"user": user_name,
"password": password,
"dbs_port": port,
"logmech": logmech,
}

self.client = teradatasql.connect(**self.teradata_config)
Expand Down