Skip to content

Datastore update schema #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Sep 13, 2016
Merged

Datastore update schema #501

merged 22 commits into from
Sep 13, 2016

Conversation

ryanmats
Copy link
Contributor

@ryanmats ryanmats commented Sep 6, 2016

Hi Jon - see this pull request for my current code for the database update schema sample.

I seem to be having a problem where adding a second Picture class with more attributes and querying does not seem to change the database schema. However, when I manually update the original Picture class and add the two attributes, then query, it seems to update.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 6, 2016
@@ -0,0 +1,29 @@
import webapp2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imports should be in 3 sections - standard library, third-party, and (optionally) application/package-local names

This should be:

import os
import time

import jinja2
import webapp2

import update_schema

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@theacodes
Copy link
Contributor

@ryanmats finished first round, let me know when you're ready for the next round.

from google.appengine.ext import deferred
from google.appengine.ext import ndb

import models_v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imports should be in alphabetical order, so v1 should be imported before v2.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


class AddEntitiesHandler(webapp2.RequestHandler):
def post(self):
reload(models_v1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment describing what this does.

Copy link
Contributor Author

@ryanmats ryanmats Sep 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

self.response.write(template.render(template_values))

app = webapp2.WSGIApplication(
[('/display_entities', DisplayEntitiesHandler), ])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close, but you can change this indent to just four spaces, e.g.:

app = webapp.WSGIApplication(
    [(....

Jon Wayne Parrott and others added 4 commits September 9, 2016 13:54
Change-Id: I2b1f2299364ce8e5caf7894046916cc2a6140719
Change-Id: I932cf3076c9009c2439d0591b1967bf2fd1fd34c
update_schema_task, cursor=query.cursor(), num_updated=num_updated)
else:
logging.debug(
'UpdateSchema complete with {0} updates!'.format(num_updated))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and change this string to 'update_schema_task complete with {} updates.'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

ryanmats and others added 3 commits September 13, 2016 12:25
Change-Id: Id5f70ef3e01b44d5ec44649d467d072b3541e850
Change-Id: I0c0e982bcf6243ec096348423128c17da2ced250
@theacodes theacodes merged commit c48d2e7 into master Sep 13, 2016
@theacodes theacodes deleted the datastore-update-schema branch September 13, 2016 20:04
arbrown pushed a commit that referenced this pull request Nov 7, 2022
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
dandhlee pushed a commit that referenced this pull request Nov 9, 2022
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants