Updated on 2022-11-18 GMT+08:00

Running Python3 and Viewing Results

Running Python in CLI Mode

  1. Grant the execution permission for the script of python3-examples folder. Run the following command in the CLI:

    chmod +x python3-examples -R.

  2. In python3-examples/pyCLI_nosec.py, change the value of host to the service plane IP address of the node where HiveServer is installed, and change the value of port to the port (hive.server2.thrift.port) used by Hive to provide the Thrift service. The default value is 21066.

    When the multi-instance is enabled: In python3-examples/pyCLI_nosec.py, the hosts must be modified. In addition, the port must be set according to the used instance. The port (hive.server2.thrift.port) is used for Hive to provide the Thrift service.

  3. Run the following commands to start the Python3 client:

    cd python3-examples

    python pyCLI_nosec.py

  4. In the CLI, view the HQL query results in the example codes. For example:

    ('table_name1',)
    ('table_name2',)
    ('table_name3',)
    ('table_name4',)
    ('table_name5',)

    In the preceding command, table_nameX indicates the actual table name.