DISCLAIMER: Please note that the content of this blog post is for demonstration purpose only, it should not be used productively without impact evaluation on production environment.
Introduction:
In this blog, we will implement an end to end solution for Python based web application(Flask) on SAP Business Technology Platform.
◉ We will use a cloud based HANA DB, and will leverage python package hdbcli to fetch the relevant data using SQL statement.
◉ We will be using python data science packages such as pandas,seaborn and matplotlib to display various graphs showing Exploratory Data Analysis.
◉ Node js will be used as a single point of entry to access our Python Application.Python package xssec will be used for authentication.
◉ Finally we will deploy this application on Launchpad.
◉ Data Source : CO2 and Greenhouse Gas Emissions Country Profiles, we can use the CSV file for uploading in SAP HANA Database Explorer. [ https://ourworldindata.org/co2-and-other-greenhouse-gas-emissions ]
Above references/links will be used for implementing the complete implementation steps.
Main Part :
Data Preparation:
1. Firstly lets upload the downloaded CSV file(owid-co2-codebook.csv) into SAP HANA Cloud database using Database Explorer as mentioned in above tutorial 1.
2. Make country and year as the primary key.
Connecting Python with SAP HANA Cloud:
1. Connect to the SAP HANA Cloud DB with the help of tutorial 2.
2. Download the GITHUB files from here, for reference purpose.
3. Replace the USERNAME,PASSWORD and URL in file env_cloud.json with your instance details.
4. URL can be retrieved from Copy SQL Endpoint by removing port number.Provide port number in port field.
5. Update manifest.yml file with the application names as per your needs.
6. Update requirements.txt with the python packages you want to use while developing the model.
7. Update runtime.txt with the python runtime version supported.
Deployment of Application:
1. Install CLI with the help of tutorial 4, please note cf.exe file should exist in the same directory as you have manifest.yml file.
2. Login to Cloud Foundry using commands cf login or cf login –sso
3. Push the extracted and modified folder containing above files using command cf push
4. In case of successful push , you will be able to see both the applications running in BTP Cockpit.
5. In case of any runtime error in python , error log can be inspected in SAP BTP.
6. Application can be opened using application route :
Configure the application on Launchpad:
i. Configure the launchpad using tutorial 5 including Application/Catalog and Group.
ii. Provide application route as per your application in URL:
Conclusion:
Demonstration:
1. Configured application is deployed to the launchpad
2. Application will display a link to the Flask frame-work python Application. We can click on it to display the details as well.
3. We can see different graphs showing the correlation between the features.
No comments:
Post a Comment