Hey Everybody, I am new to python and the datastore so I am in the perfect place to document my questions to make it easier for the next person. I am going to avoid all the display stuff and just talk about getting data in and out of the datastore. In this example we are going to develop a backend database for books.
What is the ancestry stuff and how should I really organize my data? Should we put everything into books and magazines? Books -> book 1, book 2 Magazines -> mag 1, mag 2 What does that look like in python or java? class Books(db.Model): pass class Book(Books): name = db.StringProperty(required=True) created = db.DateProperty(auto_now_add=True) How do I put that into the datastore? book = Books(name="test book") book.put() How do you get the key of that book? book.key() How do you find all the books? books = db.GqlQuery("SELECT * FROM Book WHERE ANCESTER IS Books ORDER BY created DESC LIMIT 10") How do I loop through the results? for book in books: print book.key() ???? print book.name Thanks, Ben ps In the example they use the method below to create a key.. What does it really mean or do? def guestbook_key(guestbook_name=None): """Constructs a Datastore key for a Guestbook entity with guestbook_name.""" return db.Key.from_path('Guestbook', guestbook_name or 'default_guestbook') -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/adHpULIyTJIJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.