Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Added child_enpoints_model example. #112

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rhodul
Copy link

@rhodul rhodul commented Oct 28, 2014

As per #110 (comment) I have added the example for simple parent child relationship.

@@ -0,0 +1,17 @@
application: my-api
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is identical to the app config for basic, can you make this a symlink as in

https://github.com/GoogleCloudPlatform/endpoints-proto-datastore/blob/master/examples/basic_with_auth/app.yaml

@dhermes
Copy link
Contributor

dhermes commented Oct 28, 2014

@rhodul Thanks for being so thorough! I'm going to check out your branch since viewing an entire new file as a diff is a bit hard on the eyes. A general word of advice, create a new branch before make a pull request so that your master branch can always be a clean copy of the main repo.

@@ -0,0 +1,205 @@
# If you have not yet seen the source in keys_with_ancestors/main.py, please take a look.
Copy link
Contributor

Choose a reason for hiding this comment

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

This line (and lines 51 and 53, to name a few) exceed 80 chars, please adhere to PEP8 as close as possible.

@rhodul
Copy link
Author

rhodul commented Oct 29, 2014

I know, sorry about that. I realized it a bit too late.

On Tue Oct 28 2014 at 4:32:52 PM Danny Hermes notifications@github.com
wrote:

@rhodul https://github.com/rhodul Thanks for being so thorough! I'm
going to check out your branch since viewing an entire new file as a diff
is a bit hard on the eyes. A general word of advice, create a new branch
before make a pull request so that your master branch can always be a clean
copy of the main repo.

Reply to this email directly or view it on GitHub
#112 (comment)
.

# we include "parent" in the request path by setting
# path='mymodel/{parent}'.
# Unlike in keys_with_ancestors/main.py, we want a datastore to generate
# child ID, therefore we do not include it in the request body.
Copy link
Contributor

Choose a reason for hiding this comment

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

(Moving conversation here to latest diff)

The statement "we do not include it in request body" doesn't clearly indicate why this happens. Instead you could say

  # Unlike in keys_with_ancestors/main.py, we want the datastore to generate
  # child ID, therefore we do not include it in the default message fields schema
  # which determines the request body.

@pfried
Copy link

pfried commented Apr 30, 2015

Thank you for this example,maybe i would still trying to find out what is wrong with my code if i had not found it.

Unfortunately the keys with ancestors example uses a string identifier as the id, which is unnecessary to get started. It would be very helpful to have a standard ancestor-child example you can use for getting started and just copy&paste

@dhermes
Copy link
Contributor

dhermes commented Apr 30, 2015

@pfried That example is quite complex. The 10 examples are listed on
http://endpoints-proto-datastore.appspot.com/
essentially in order of complexity.

How do imagine you could get ancestor-child in a different way that would be simpler?

@pfried
Copy link

pfried commented Aug 3, 2015

@dhermes I would imagine two simple models coupled as parent child by the id property.

The ancestor example http://endpoints-proto-datastore.appspot.com/examples/keys_with_ancestors.html couples them by the parent name, which mixes in another aspect (string field as key). I know most examples cover more than one aspect. But as the ancestor is already very complex i would like to see an example which uses the id property for building the key

@dhermes
Copy link
Contributor

dhermes commented Aug 3, 2015

@pfried
Copy link

pfried commented Aug 3, 2015

@dhermes Sorry, i just took a look at it again (wrote the first comment when i started using the lib) and i realize that it already is the way i asked it to be.

I think i got confused on the if not isinstance(value, basestring): raise TypeError('ID must be a string.') of the Child, because i thought of it as a numerical value

thank you for your patience

@dhermes
Copy link
Contributor

dhermes commented Aug 3, 2015

No worries. Glad the library helps you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants