Hive CLI Connection¶
The Hive CLI connection type enables the Hive CLI Integrations.
Authenticating to Hive CLI¶
There are two ways to connect to Hive using Airflow.
Use the Hive Beeline. i.e. make a JDBC connection string with host, port, and schema. Optionally you can connect with a proxy user, and specify a login and password.
Use the Hive CLI. i.e. specify Hive CLI params in the extras field.
Only one authorization method can be used at a time. If you need to manage multiple credentials or keys then you should configure multiple connections.
Default Connection IDs¶
All hooks and operators related to Hive_CLI use hive_cli_default by default.
Configuring the Connection¶
- Login (optional)
Specify your username for a proxy user or for the Beeline CLI.
- Password (optional)
Specify your Beeline CLI password.
- Host (optional)
Specify your JDBC Hive host that is used for Hive Beeline.
- Port (optional)
Specify your JDBC Hive port that is used for Hive Beeline.
- Schema (optional)
Specify your JDBC Hive database that you want to connect to with Beeline or specify a schema for an HQL statement to run with the Hive CLI.
- Use Beeline (optional)
Specify as
Trueif using the Beeline CLI. Default isFalse.- Proxy User (optional)
Specify a proxy user to run HQL code as this user.
- Principal (optional)
Specify the JDBC Hive principal to be used with Hive Beeline.
- High Availability (optional)
Specify as
Trueif you want to connect to a Hive installation running in high availability mode. Specify host accordingly.- Ssl (optional)
Specify as
Trueto enable SSL for your high availability connection.- Zoo Keeper Namespace (optional)
Zoo keeper namespace for high availability.
Additional JDBC Parameters¶
Dag authors can pass additional Beeline JDBC URL parameters to HiveCliHook or HiveOperator
with the jdbc_params argument:
HiveCliHook(
jdbc_params={
"transportMode": "http",
"sslTrustStore": "/opt/hive/truststore.jks",
"trustStorePassword": "secret",
}
)
These parameters are appended to the Beeline JDBC URL. Parameter names must match
^[A-Za-z]([A-Za-z0-9._-]*[A-Za-z0-9])?$ (start with a letter, contain only letters, digits,
dots, underscores, or hyphens, and not end in a separator). Values must be strings. Empty strings
are ignored; semicolons are rejected.
jdbc_params can only be set through HiveCliHook or HiveOperator; arbitrary JDBC
parameters are not read from connection extras.
When specifying the connection in environment variable you should specify it using URI syntax.
Note that all components of the URI should be URL-encoded.
For example:
export AIRFLOW_CONN_HIVE_CLI_DEFAULT='hive-cli://beeline-username:beeline-password@jdbc-hive-host:80/hive-database?hive_cli_params=params&use_beeline=True&auth=noSasl&principal=hive%2F_HOST%40EXAMPLE.COM'