0
votes

I have problems to succeed the configuration of sap hana and python. The data I need is located in sap hana and I want to do some analysis with python. My description may seem a little bit stupid, but I only learned how to do analyses with python and I have absolutely no knowledge about installations and computers. In article saphanatutorial com / sap-hana-and-python

there is a description of how you should do this. I copied the files init.py, dbapi.py and resultrow.py to the Lib folder in hdbclient. I also copied the files pyhdbcli.pdb and pyhdbcli.pyd to the python/lib folder.

Then I used spyder (came with Anaconda) as editor, and I run

Test_Python_HANA.py import dbapi

conn = dbapi.connect('ecX-XX-XX-XXX-XXX.compute-1.amazonaws.com', 30015, 'SYSTEM', 'manager')

print conn.isconnected()

As described in the article on internet. but then there is a message: dbapi is not found.

Then I tried to run the code mentioned in this article: scn sap com community developer-center hana blog 2012 06 08 sap-hana-and-python-yes-sir (in the square underneath Connect to SAP HANA and Run SQL Queries using Python:)

But then I also got the message: dbapi not found. Then I saw that the python in hdbclient is python 2.6 but i need 2.7, so i erased the python26 folder in the hdbclient folder (because I didn't saw it in my programs screen where I could uninstall it) and I moved the python27 folder to the hdbclient folder (and I copied the folders that I mentioned before again in the python folder). Then of course the same message. But the dbapi.py is in the hdbclient folder, so I thought if I put the script in the same folder, maybe I don't get that message. But it still says that dbapi.py is not found (while it is in the same folder!).

And later I saw that Anaconda also installed an extra python.exe, (while there is only 1 visible in my programs if I look in my computer. Anaconda worked, so I thought maybe it doensn't work because there are 2 python.exe (see picture). So I tried to change the path (I'm not sure if I did it right: in the right top of Spyder there is a path, and the description is: "this is the working directory for newly opened consoles for the file explorer, for the plugins, and for new files created in the editor") and I did go the the python27 folder in hdbclient and clicked on python.exe. But this didn't work either.

This story maybe sounds a little bit like a mess, and that is true because it also is (I have no idea what to do). I just want to open a python editor (I don't care which one), load the data that is stored in sap hana and start with my analysis. But I don't understand the installation/configuration process. I hope someone can and wants to help me. picture of the python files

1
I'm sorry the links in the message are with 2 dots and from then on are all the white spaces "/ " but I could only ad 1 link because I'm new here - jebk

1 Answers

1
votes

3rd party resources on SAP software, SAP HANA no exception, tend to just copy from SAP docs and SCN. While the SAP docs are maintained and updated to advancing technology and new SPS's, these copies are often left abandoned, making search for up to date information a mess.

In the case of Python-HANA-interfacing, you might want to go to the sources and find the most recent adapter on GitHub: https://github.com/SAP/PyHDB This is reported to work on all recent Python versions, so it will perfectly integrate with your Anaconda setup.

But even this does not leave you without need for a sound knowledge about Python ;)