Skip to Content
Author's profile photo Craig Cmehil

PHP and MySQL?

Recently as I’ve dug more and more into HANA (how could I not with Tom and Rich publishing so many cool things?) I found that I could take many of my existing demos from PHP and MySQL and port them to HANA. The pain though has always been migrating DB content so I decided to make a simple little tool to make life easier.

It was during the SAP InnoJam event in Madrid that I sat down and coded something that I was able to test with Rich’s help, HOWEVER this is not something SAP supports or even validates or approves this is just me and my own HANA Cloud instance having some fun and deciding to share!

Screen-Shot-2012-11-24-at-14.02.07.png

GitHub – Move to HANA

I call it Move to HANA and you can find the code on GitHub. It’s fairly simple and I used JQuery Mobile(don’t hate me SAP UI5 lovers) to put it together, just upload it to your PHP server and run it.

The idea behind it, is to give a simple migration tool that will help generate the HANA specific SQL to get your same tables and fields generated and your data uploaded via the HANA Studio. Right now it’s setup for MySQL but is easily expanded for any DB you are working on; oh and of course it’s not 100% yet it’s only got a handful of the different field types but hey – it’s GitHub go ahead and make some changes!

As for execution – again very simple.

Screen-Shot-2012-11-24-at-14.02.51-1024x635.png

Database selection

Once your select your database then you will need to log into the database to select which “database” you want to migrate.

Screen-Shot-2012-11-24-at-14.06.43-1024x634.png

Login into your database

Then select your “database” at which point the script will generate the 3 step process for data migration.

Screen-Shot-2012-11-24-at-14.07.24-300x90.png

Simple 3 Steps

Step 1, will provide your the “copy and paste” script you need to enter into your HANA Studio.

Screen-Shot-2012-11-24-at-14.07.46.png

HANA SQL to generate SCHEMA

Step 2, will provide the command line code for MySQL to generate the CSV files you can then upload via the HANA Studio

Screen-Shot-2012-11-24-at-14.08.00.png

Command Line for MySQL Dumps

Step 3, will provide the SQL command to ensure the proper permissions for the newly generated SCHEMA

Screen-Shot-2012-11-24-at-14.08.56.png

SCHEMA permissions

I’ve used the script a dozen times already to get sample data and other MySQL data moved into HANA to allow myself more and more opportunities to try my hand at HANA coding and it’s worked quite well. If you give a try feedback would be great and if you find new data types or if you want to try a different database than MySQL by all means have at it!!

** SAP does not support nor endorse this tool and there is no support other than the very little free time that I personally have to answer comments. **

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo flavio ciotola
      flavio ciotola

      Hi Craig,

      Thank you for sharing. I'm going to try it with my free HANA trial 🙂 .

      (a little remark: the above GitHub link returns a 404, the right one being

      https://github.com/SAP/data-move-to-hana ).

      Thank you!

      Flavio