Pages

Thursday 30 January 2014

Power of Python Integrated with SAP HANA


Power of Python Integrated with SAP HANA:

Python is a high-level, object-oriented programming language for the web.
Python is easy to write, easy to read and easy to understand.
SAP HANA works quite well with Python.
This article gives a basic idea of how to use Python on SAP HANA.
Contact us for more details and Session Schedules at:
  IND: +91- 9948030675, 
USA: +1-319-804-4998
Email: info@sryitsolutions.com, 

Power of Python Integrated with SAP HANA


Note: Even if you are not familiar with Python, do not worry. We are all and cover everything in detail for you.

Python API:
There are several APIs available for free Python for SAP HANA. In this article, we are one of the easiest, use the DB-API.
dbapi API is Python DB-API 2.0.

Configure Python API in SAP HANA:

1 Navigate to the location where you installed the client HANA and copy these three files.
__init__.py dbapi.py, resultrow.py

Configure Python API in SAP HANA
By default it is installed in C: Program Files folder Filessaphdbclienthdbcli.
2 Navigate to the folder under the folder HDBClient Python and copy all three files in the lib.
By default, the path C: Program FilessaphdbclientPythonLib
3 Copy pyhdbcli.pdb, pyhdbcli.pyd files from hdbclient.
By default, this location is "Program Filessaphdbclient C" is
4 On the same folder pythonlib and add these 2 files.
This is all.Configuration done! ...
Connect to SAP HANA and Run SQL Queries using Python:


1. Write below code in a notepad and save with .py extension. 



import dbapi
## Replace SCHEMA1 with your schema

# assume HANA host id is abcd1234 and instance no is 00. user id is USER1 and password is Password1
conn = dbapi.connect('abcd1234', 30015, 'USER1', 'Password1')

#Check if database connection was successful or not
print conn.isconnected()

# create a table
cursor = conn.cursor()
stmnt = 'Create column table SCHEMA1.table1 (ID integer, name varchar(10))'
cursor.execute(stmnt)
print 'table created'

# insert some data into table
stmnt = 'insert into SCHEMA1.table1 values (?, ?)'
cursor.execute(stmnt, (1,'A'))
cursor.execute(stmnt, (2,'B'))
print '2 records inserted into table'

# fetch table data
stmnt = 'select * from SCHEMA1.table1'
cursor.execute(stmnt)
result = cursor.fetchall()
print result

2. Provide system data HANA and recording information of the file.
3. Make sure that you change the name of the schema with your schema.
4. Now save the file in the folder hdbclientPython.
The default location of Python folder "C: Program FilessaphdbclientPython"
5. Open ask. Switch to the Python path, and run the command

16 comments:

  1. Hi,

    You provided best information about sap hana.you blog is very help full to sap hana learners. HANA is an in-memory data platform that is deployable as an appliance or in the cloud.we provides SAP HANA Online Training By SAP certified Professional

    ReplyDelete
  2. Hello sir
    This blog was very nice.
    Application development and system management with SAP HANA. With the continued availability of SAP River under an early adoption program, you can
    simplify the development and deployment of SAP HANA-based applications. SAP HANA also extended its native HA/DR support with synchronous replication,
    even to multiple hot standbys, providing near zero downtime for upgrades and maintenance. With the ability to monitor important KPIs from any device
    from anywhere and intelligent diagnostics for non-responsive systems, system administration has been simplified.

    SAP HANA ONLINE TRAINING

    ReplyDelete
  3. SAP HANA provides the platform to build a new generation of solutions – a powerful foundation to help deliver ground breaking innovations without disruption. This real-time platform combines high-volume transactions with analytics to help create solutions that take your business performance to the next level.

    SAP HANA ONLINE TRAINING

    ReplyDelete
  4. I am very much satisfied with your info. I wish I can get furthered info from you. I am very glad to say thanks for this info.
    thank you very much sir
    Any Sbody wantslearn SAP HANA ADMINISTRATION ONLINE TRAININGthrough Online for Details Please go through the Link
    SAP HANA ADMINISTRATION ONLINE TRAINING

    ReplyDelete
  5. Basically SAP HANA is a database. It addresses many problems which are being faced in the traditional databases through its In-Memory concept. With Smartmind online training you get the power to develop In-Memory apps that analyze massive volumes of data in real-time.
    Smartmind is among the many primary strain HANA Training Start with each of the intent behind supplying a sap hana online training
    .We make use of a band of very-skilled university within their individual courses. Smartmind is just a love for your downline. We're often the main one on the list of drain HANA Coaching Firm where school has professionalism degree of technical knowledge, large and commitment.

    ReplyDelete
  6. I have seen your info on sap.. Especially on sap hana. The info you provided is very useful for any interested on sap. I am very much satisfied with your info. I wish I can get furthered info from you.I am very glad to say thanks for this info.. we also provide online training onSAP HANA ADMINISTRATION ONLINE TRAINING

    ReplyDelete
  7. Your blog was excellent. Posted best topics for the readers help them to get to know things. Also helps the readers to choose the better career.
    updates we also provide online training on SAP HANA ADMINISTRATION ONLINE TRAINING

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Excellent piece of information on sap hana ,I feel it is right place to get info on sap bods .This was really something, I had been looking for days. Too excited to view your other blogs on bods .

    sap bods online training

    ReplyDelete
  10. BPC online training job examples may help you in attaining bpc qualifications & additionally.
    SAP BPC training Class content Is designed to get the location in leading MNC firms whenever the SAP BPC program is completed by you than more details vist this site SAP BPC ONLINE TRAINING

    ReplyDelete
  11. Python Integration Concept is very nice thank you for sharing python Online Training

    ReplyDelete