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: add Impala connection optional parameters (#743) #790

Merged
merged 2 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 16 additions & 0 deletions data_validation/cli_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,22 @@
"kerberos_service_name",
"Desired Kerberos service name ('impala' if not provided)",
],
["use_ssl", "Use SSL when connecting to HiveServer2 (default is False)"],
[
"timeout",
"Connection timeout in seconds when communicating with HiveServer2 (default is 45)",
],
[
"ca_cert",
"Local path to 3rd party CA certificate or copy of server certificate for self-signed certificates. If SSL is enabled, but this argument is None, then certificate validation is skipped.",
],
["user", "LDAP user to authenticate"],
["password", "LDAP password to authenticate"],
[
"pool_size",
"Size of the connection pool. Typically this is not necessary to configure. (default is 8)",
],
["hdfs_client", "An existing HDFS client"],
],
"DB2": [
["host", "Desired DB2 host"],
Expand Down
10 changes: 9 additions & 1 deletion docs/connections.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,15 @@ Please note AlloyDB supports same connection config as Postgres.
"host": "127.0.0.1",
"port": 10000,
"database": "default",
"auth-mechanism":"PLAIN"
"auth-mechanism": "PLAIN",
# (Optional)
"use-ssl": False,
"timeout": 45,
"ca-cert": "path-certificate",
"user": "user",
"password": "password",
"pool-size": 10,
"hdfs-client": "hdfs-client"
}
```

Expand Down
18 changes: 18 additions & 0 deletions third_party/ibis/ibis_impala/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,37 @@ def impala_connect(
database="default",
auth_mechanism="PLAIN",
kerberos_service_name="impala",
use_ssl=False,
timeout=45,
ca_cert=None,
user=None,
password=None,
pool_size=8,
hdfs_client=None
):
auth_mechanism = (auth_mechanism, "PLAIN")[auth_mechanism is None]
database = (database, "default")[database is None]
port = (port, 10000)[port is None]
kerberos_service_name = (kerberos_service_name, "impala")[
kerberos_service_name is None
]
use_ssl = (use_ssl, False)[use_ssl is None]
timeout = (timeout, 45)[timeout is None]
pool_size = (pool_size, 8)[pool_size is None]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to add user, password, ca_cert, and the other variables here too? Or will it be picked up from the default parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took as a reference how the code was already handling "host" parameters. Since the default value is None then it is not added in this section; for the other variables the default values are boolean or Int, and that is why it validates if the value is None to assign the default value. If it requires a change just let me know.


return connect(
host=host,
port=int(port),
database=database,
auth_mechanism=auth_mechanism,
kerberos_service_name=kerberos_service_name,
use_ssl=use_ssl,
timeout=timeout,
ca_cert=ca_cert,
user=user,
password=password,
pool_size=pool_size,
hdfs_client=hdfs_client
)


Expand Down