def migrate_setting(): try: cnx = mysql.connector.connect( host=self.host, user=self.username, password=self.password, database=self.database, ) cursor = cnx.cursor() query = "SELECT * FROM setting" cursor.execute(query) for (id, category, name, value, updatedby, updatedat) in cursor: u = Setting() u.id = id u.category = category u.name = name u.value = value u.updated_by = updatedby u.updated_on = updatedat db.session.add(u) db.session.commit() cursor.close() cnx.close() return "done" except Exception as e: return str(e), 500
def testClassAccessors( self ): setting = Setting( app_name = 'Foobar', app_version = 0.01, allow_registration = True ) setting.put() self.assertEqual( Setting.all().count(), 1 ) self.assertEqual( Setting.name(), 'Foobar' ) self.assertEqual( Setting.version(), '0.01' )