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!
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.
Once your select your database then you will need to log into the database to select which “database” you want to migrate.
Login into your database
Then select your “database” at which point the script will generate the 3 step process for data migration.
Simple 3 Steps
Step 1, will provide your the “copy and paste” script you need to enter into your HANA Studio.
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
Command Line for MySQL Dumps
Step 3, will provide the SQL command to ensure the proper permissions for the newly generated SCHEMA
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. **