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 2 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
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, logmech: str, port: Optional[int] = 1025
) -> 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 : str
Logmech flag to select with
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, logmech, port)
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 the TeradataClient init method takes the parameters in a different order. I would put logmech after port and make it Optional. The teradatasql.connect() documentation shows that "TD2" should be the default logmech

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in the new commit.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Logmech is still before port. When instantiating a TeradataClient class, this will fail.

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, use_no_lock_tables=False, logmech):
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you go with my suggestion to put the logmech after the port, this will need to be re-ordered like so:
def __init__(self, host, user_name, password, port=1025, logmech="TD2", use_no_lock_tables=False):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it! updated in the new commit

"""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