Google App Engine Data Store ae-10-datastore www.appenginelearn.com.

Slides:



Advertisements
Similar presentations
Widhy Hayuhardhika NP, S.Kom. Overview of database structure Connecting to MySQL database Selecting the database to use Using the require_once statement.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
PRACTICAL PHP AND MYSQL WALKTHROUGH USING SAMPLE CODES – MAX NG.
PHP (2) – Functions, Arrays, Databases, and sessions.
J4www/jea Week 3 Version Slide edits: nas1 Format of lecture: Assignment context: CRUD - “update details” JSP models.
Dynamic Web Pages. Web Programming  All our web pages so far have been static pages. 1. We create a web page 2. We upload it to the web server 3. People.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
Software Architecture Patterns (2). what is architecture? (recap) o an overall blueprint/model describing the structures and properties of a "system"
Stanford University EH&S A Service Oriented Architecture For Rich Internet Applications Sheldon M. Heitz.
Google App Engine and Java Application: Clustering Internet search results for a person Aleksandar Kartelj Faculty of Mathematics,
Google App Engine Danail Alexiev Technical Trainer SoftAcad.bg.
UNIT-V The MVC architecture and Struts Framework.
dcDB Stored Procedures: An Overview
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 35 – Python Outline 35.1 Introduction First Python Program Python Keywords 35.2 Basic.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
Googe App Engine Codelab Marzia Niccolai May 28-29, 2008.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
About Dynamic Sites (Front End / Back End Implementations) by Janssen & Associates Affordable Website Solutions for Individuals and Small Businesses.
What is Architecture  Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project  In the.
A Level Computing#BristolMet Session Objectives U2#S6 MUST identify different data types used in programming aka variable types SHOULD describe each data.
Cloud computing lectures: Programming with Google App Engine Keke Chen.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Advanced Web Forms with Databases Programming Right from the Start with Visual Basic.NET 1/e 13.
Ajax and Ruby on Rails Session 9 INFM 603.
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
MVC & ActiveRecord by Christian Mohr & Mohamed Souiai.
Lecture 19 Web Application Frameworks Boriana Koleva Room: C54
Meet with the AppEngine Márk Gergely eu.edge. What is AppEngine? It’s a tool, that lets you run your web applications on Google's infrastructure. –Google's.
06/10/2015AJAX 1. 2 Introduction All material from AJAX – what is it? Traditional web pages and operation Examples of AJAX use Creating.
Week seven CIT 354 Internet II. 2 Objectives Database_Driven User Authentication Using Cookies Session Basics Summary Homework and Project 2.
PHP and MySQL CS How Web Site Architectures Work  User’s browser sends HTTP request.  The request may be a form where the action is to call PHP.
(Chapter 10 continued) Our examples feature MySQL as the database engine. It's open source and free. It's fully featured. And it's platform independent.
Lecture 8 – Cookies & Sessions SFDV3011 – Advanced Web Development 1.
Mainframe (Host) - Communications - User Interface - Business Logic - DBMS - Operating System - Storage (DB Files) Terminal (Display/Keyboard) Terminal.
Prof Frankl, Spring 2008CS Polytechnic University 1 Overview of Web database applications with PHP.
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
Google App Engine Using Templates Jim Eng Thanks to Chuck Severance
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
Javascript Intro
.  A multi layer architecture powered by Spring Framework, ExtJS, Spring Security and Hibernate.  Taken advantage of Spring’s multi layer injection.
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
Google App Engine MemCache ae-09-session
App Engine Web App Framework Jim Eng
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
Caching Willem Visser RW334. Overview AppEngine Datastore No Caching Naïve Caching Caching invalidation Cache updating Memcached Beyond your code.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
OOSSE Week 8 JSP models Format of lecture: Assignment context JSP models JSPs calling other JSPs i.e. breaking up work Parameter passing JSPs with Add.
Google App Engine References ae-11-chat
Google App Engine Sessions and Cookies ae-09-session
>> PHP: MySQL & CRUD. R ecall Database Tables Records is composed of Operations (CRUD) Create Retrieve Update Delete DBMS Access Control MySQL phpMyAdmin.
Forms and PHP Dr. Charles Severance
Apache Struts Technology A MVC Framework for Java Web Applications.
Google App Engine Mano Marks Developer Advocate. Problems building web applications Why Google App Engine? The App Engine Components What’s Next Questions?
Teaching slides Chapter 6. Chapter 6 Software user interface design & construction Contents Introduction Graphical user interface – Rich window based.
Jim Fawcett CSE686 – Internet Programming Spring 2014
JavaScript and Ajax (Ajax Tutorial)
Jim Fawcett CSE686 – Internet Programming Spring 2012
Server Concepts Dr. Charles W. Kann.
OUTLINE Basic ideas of traditional retrieval systems
MVC Framework, in general.
Web Systems Development (CSC-215)
PDO Database Connections: Getting data out of the database
Web Application Architectures
Web Application Architectures
Web Application Architectures
Model View Controller (MVC)
Presentation transcript:

Google App Engine Data Store ae-10-datastore

Google is BIG Google’s main applications are their search and mail The entire Internet and everyone’s mail is a lot of data Traditional data storage approaches such as a relational database just don’t scale to the size at which Google applications operate Sharded, sorted, array with hierarchical keys

Advanced Stuff datastore

Model-View-Controller Design Pattern

HTTP Request HTTP Response Browser Web Server

Tasks Inside the Server Process any form input - possibly storing it in a database or making some other change to the database such as a delete Decide which screen to send back to the user Retrieve any needed data Produce the HTML response and send it back to the browser

HTTP Request HTTP Response Browser Web Server Store Data HandleInput Retriev e Data BuildHTML

Request Response Web Server Store Data HandleInput Retriev e Data BuildHTML Data Server

Terminology We call the Data bit - the “Model” or Data Model We call the “making the next HTML” bit the “View” or “Presentation Layer” We call the handling of input and the general orchestration of it all the “Controller”

Model View Controller We name the three basic functions of an application as follows Controller - The Python code that does the thinking and decision making View - The HTML, CSS, etc. which makes up the look and feel of the application Model - The persistent data that we keep in the data store

Model-View-Controller “In MVC, the model represents the information (the data) of the application and the business rules used to manipulate the data; the view corresponds to elements of the user interface such as text, checkbox items, and so forth; and the controller manages details involving the communication to the model of user actions.”

HTTP Request HTTP Response Browser Web Server 1 Controller Model View

Our Architecture: MVC Model - Holds the permanent data which stays long after the user has closed their web browsers View - Produces the HTML Response Controller - Receives each request and handles input and orchestrates the other elements

Controller “Orchestrates” Logic ViewBrowser Model Cookies Session The controller is the conductor of all of the other aspects of MVC. Ajax

Adding Models to our Application ae-10-datastore

DJango Models Thankfully we use a very simple interface to define objects (a.k.a. Models) and store them in BigTable BigTable is where the models are stored We don’t need to know the details The pattern of these models is taken from the DJango project

A Simple Model from google.appengine.ext import db # A Model for a User class User(db.Model): acct = db.StringProperty() pw = db.StringProperty() name = db.StringProperty() newuser = User(name=”Chuck”, acct=”csev”, pw=”pw”) newuser.put() Each model is a Python class which extends the db.Model class.

Property Types StringProperty - Any string IntegerProperty - An Integer Number DateTimeProperty - A date + time BlobProperty - File data ReferenceProperty - A reference to another model instance

Keep it simple for a while from google.appengine.ext import db # A Model for a User class User(db.Model): acct = db.StringProperty() pw = db.StringProperty() name = db.StringProperty() newuser = User(name=”Chuck”, acct=”csev”, pw=”pw”); newuser.put(); Each model is a Python class which extends the db.Model class.

Inserting a User and listing Users

class ApplyHandler(webapp.RequestHandler): def post(self): self.session = Session() xname = self.request.get('name') xacct = self.request.get('account') xpw = self.request.get('password') # Check for a user already existing que = db.Query(User).filter("acct =",xacct) results = que.fetch(limit=1) if len(results) > 0 : doRender(self,"apply.htm",{'error' : 'Account Already Exists'} ) return newuser = User(name=xname, acct=xacct, pw=xpw); newuser.put(); self.session['username'] = xacct doRender(self,"index.htm",{ }) Insert User Get Session Form Data Check for existing user. Update Session

Using the Developer console we can see the results of the put() operation as a new User object is now in the data store. newuser = User(name=xname, acct=xacct, pw=xpw); newuser.put();

class MembersHandler(webapp.RequestHandler): def get(self): que = db.Query(User) user_list = que.fetch(limit=100) doRender(self, 'members.htm', {'user_list': user_list}) We simply construct a query for the User objects, and fetch the first 100 User Objects. Then we pass this list into the members.htm template as a context variable named ‘user_list’.

{% extends "_base.htm" %} {% block bodycontent %} Members Name Account Password {% for user in user_list %} {{ user.name }} {{ user.acct }} {{ user.pw }} {% endfor %} {% endblock %} templates/members.ht m In the template, we use the for directive to loop through each user in the user_list variable in the context. For each user we construct a table row with their name, account, and pw.

Up Next... Multiple Models and links between models