Configuring the Python Sample Project
Scenario
To run the Python interface example codes of the Hive component of MRS, perform the following operations.
- MRS 3.1.2 and later versions support only Python3 by default.
- The sample can run only on Linux nodes.
Procedure
- Python of 2.6.6 or a higher version has been installed on a client. The Python version cannot be higher than 2.7.13.
The Python version can be viewed by running the python command on the command-line interface (CLI) of the client. The following information indicates that the Python version is 2.6.6.
Python 2.6.6 (r266:84292, Oct 12 2012, 14:23:48) [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
- Setuptools of 5.0 or a higher version has been installed on a client. The setuptools version cannot be higher than 36.8.0. You can obtain the corresponding installation package from https://pypi.org/project/setuptools/#files.
Copy the downloaded setuptools package to the client, decompress the package, go to the decompressed directory, and run the following command in the CLI of the client:
python setup.py install
The following information indicates that setuptools 5.7 is installed successfully.
Finished processing dependencies for setuptools==5.7
- Install Python on the client.
- Obtain the sample project folder python-examples in the src\hive-examples directory where the sample code is decompressed. For details, see Obtaining the MRS Application Development Sample Project.
- Go to the python-examples folder.
- Run the following command in the CLI.
The following information indicates that Python is installed successfully.
Finished processing dependencies for pyhs2==0.5.0
- After the installation is successful, the following files are generated. python-examples/pyCLI_nosec.py is the Python client example codes. python-examples/pyhs2/haconnection.py is the Python client API. Run hive_python_client scripts to execute the SQL functions, for example, sh hive_python_client 'show tables'. This function applies to only simple SQL statements and depends on the ZooKeeper client.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot