Skip to content

Commit

Permalink
Add datastore update schema region tags (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmats authored and Jon Wayne Parrott committed Sep 14, 2016
1 parent d737aa4 commit 349cdc8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion appengine/standard/ndb/schema_update/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
populate these new fields onto entities that existed prior to adding the
new fields to the model class.
"""

# [START imports]
import logging
import os

Expand All @@ -38,8 +38,10 @@
os.path.join(os.path.dirname(__file__), 'templates')),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
# [END imports]


# [START display_entities]
class DisplayEntitiesHandler(webapp2.RequestHandler):
"""Displays the current set of entities and options to add entities
or update the schema."""
Expand All @@ -54,8 +56,10 @@ def get(self):

template = JINJA_ENVIRONMENT.get_template('index.html')
self.response.write(template.render(template_values))
# [END display_entities]


# [START add_entities]
class AddEntitiesHandler(webapp2.RequestHandler):
"""Adds new entities using the v1 schema."""
def post(self):
Expand All @@ -71,8 +75,10 @@ def post(self):
self.response.write("""
Entities created. <a href="/">View entities</a>.
""")
# [END add_entities]


# [START update_schema]
class UpdateSchemaHandler(webapp2.RequestHandler):
"""Queues a task to start updating the model schema."""
def post(self):
Expand Down Expand Up @@ -123,6 +129,7 @@ def update_schema_task(cursor=None, num_updated=0, batch_size=100):
logging.debug(
'update_schema_task complete with {0} updates!'.format(
num_updated))
# [END update_schema]


app = webapp2.WSGIApplication([
Expand Down

0 comments on commit 349cdc8

Please sign in to comment.