0
votes

I have a Google App Engine Java application, which uses Appengine datastore for its persistence (Using JPA and Datanucleus). Now I want to migrate my backend(database) to Google Cloud SQL. I have already created cloud sql account and instance. I also granted permission for my GAE app to use this instance.

Now, how I can i rewrite my app or what are the changes I should make to my application, in order to migrate to cloud sql.

Any good tutorial is there for it? Any help is greatly welcomed.

1
I don't have a link for you, migration is usually done the other way around. Why are you moving to SQL? Can you share some of your code?Dan Holevoet
Actually I am developing an app for a competition where the requirement is to use Cloud SQL as backend. my app is built and works perfectly with google datastore using JPA and Datanucleus as persistence provider. What change I have to make it to work with cloud sql. I have configured cloud sql instance in AppEngine settings of my eclipse project. @DanHolevoet which part of my code should I share with u? persistence.xml or any DAO class methods?Eljo George

1 Answers

1
votes

I would suggest following Using Google Cloud SQL with App Engine Java SDK. Once you've configured an example database, create new tables for the entities in your datastore.

For the actual data migration you have a few possible routes:

  • Download your datastore locally, manipulate the entries into SQL INSERT statements, and upload them to Cloud SQL
  • Write a script that reads through the datastore and writes rows to your SQL datastore (most likely using a task queue and datastore cursor)
  • Ignore the old data in your app and start from scratch