8000 Add datastore update schema region tags (#521) · ebadia/python-docs-samples@349cdc8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 349cdc8

Browse files
ryanmatsJon Wayne Parrott
authored and
Jon Wayne Parrott
committed
Add datastore update schema region tags (GoogleCloudPlatform#521)
1 parent d737aa4 commit 349cdc8

File tree

1 file changed

+8
-1
lines changed
  • appengine/standard/ndb/schema_update

1 file changed

+8
-1
lines changed

appengine/standard/ndb/schema_update/main.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
populate these new fields onto entities that existed prior to adding the
2121
new fields to the model class.
2222
"""
23-
23+
# [START imports]
2424
import logging
2525
import os
2626

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

4243

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

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

5861

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

7580

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

127134

128135
app = webapp2.WSGIApplication([

0 commit comments

Comments
 (0)
0