google-app-enginegoogle-cloud-datastorewebapp2sqlmigrations

Database migration tool for webapp2


I'm new to webapp2 and GAE. I'm wondering, do I must declare all database tables necessarily for my models? I do not mind writing SQL by hand. But I do not want reinvent the wheel. Is there any db migration tool for Webapp2?

EDIT

I have a models:

import logging                                             
from google.appengine.ext import db                        
from google.appengine.api import rdbms                     

_INSTANCE_NAME = 'webosteam1:webosteamdb'                  
_DataBase = 'webosdb'                                      


class Usr(db.Model):                                       
    usrID = db.IntegerProperty()                           
    usrName = db.StringProperty()                          
    usr = db.UserProperty()                                
    loginType = db.IntegerProperty()                       
    usrType = db.IntegerProperty()                         
    geoLoc = db.ReferenceProperty(GeoLoc) #GeoLoc reference
    dateCreated = db.DateTimeProperty(auto_now_add=True)   

# E.T.C...

When I start dev-server locally I have an error:

Connecting to MySQL with kwargs {'passwd': '', 'db': 'webosdb', 'unix_socket':   '/var/run/mysqld/mysqld.sock', 'host': 'localhost', 'user': '', 'port': 3306}
CRITICAL 2012-07-16 20:47:08,203 rdbms_mysqldb.py:107] MySQL connection failed! Ensure  that you have provided correct values for the --mysql_* flags when running dev_appserver.py

After I pass right keys for my locally MySQL database I have an errors about this database is empty. So I thinking about how it all works?


Solution

  • So now I assume you are using Google Cloud Sql, and you are having troubles testing your app in the development server.

    Please follow the example provided here https://developers.google.com/academy/apis/cloud/appengine/cloud-sql/application_with_local_mysql to find how to work with a local database in the development environment.