-1

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?

I159
  • 29,741
  • 31
  • 97
  • 132
  • 1
    I assume you already have a schema for you database, if so you can use Google Cloud Sql. On the other hand, you don't specify the datastore models with SQL, instead you use object definitions. See https://developers.google.com/appengine/docs/python/datastore/overview for an overview. – Sebastian Kreft Jul 16 '12 at 20:28
  • What are you migrating _from_? – Nick Johnson Jul 18 '12 at 04:44

1 Answers1

0

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.

Sebastian Kreft
  • 7,819
  • 3
  • 24
  • 41