DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Data Engineering
  3. Databases
  4. Understanding Basic Data Storage Options on Google App Engine

Understanding Basic Data Storage Options on Google App Engine

Kaushik Raghupathi user avatar by
Kaushik Raghupathi
·
Jul. 22, 10 · Interview
Like (0)
Save
Tweet
Share
8.30K Views

Join the DZone community and get the full member experience.

Join For Free

The default storage option available on the App Engine today is the Data Store, a proprietary Google database. In this post we will talk about the Google Data Store and some of the basic aspects of storage, features available and the key benefits and challenges in working with the Data Store.

What is the Google Data Store ?

Google Data Store is a scalable data storage solution for the web applicable, primarily optimized for read and query performance. The key aspect of the Data Store is that it is Entity based storage which means all data is stored and retrieved as entities and attributes. Here are the key features of the Data Store:

  • Google Data Store refers to all data in the form of Entities
  • Each entity has one more named properties
  • A property can reference another entity
  • Supports multiple operations in a single transaction
  • It is not a relational database
  • It transparently handles scalability, performance, replication, load balancing while all these aspects are abstracted from the application developer by usage of APIs

 

Creating Entities

Creating entities involves definining a model of the entity as a class in either Python/Java or other App Engine languages and creating the entity of the class in the constructor by calling the put() method of the API in the class.

Here is an example of a Employee entity in Python

  class Employee(db.Model):  
name = db.StringProperty(required=True)
role = db.StringProperty(required=True,
choices=set(["executive", "manager","producer"]))
hire_date = db.DateProperty()
new_hire_training_completed = db.BooleanProperty()
account = db.UserProperty()
Here are the steps to insert the data into the Data Store

 

    e = Employee(name="",    
role="manager",
account=users.get_current_user())
e.hire_date = datetime.datetime.now().date()
e.put()

Entity Groups allow related entities to be grouped together with a parent child relationship, allowing entities to be updated as part of a single transaction.

Querying Data in the Data Store

Querying Entities from the Data Store can be done through two interfaces: the Query interface and the GqlQuery interface

  • The Query interface prepares a query using instance methods. Here is a usage example for the filter() method retrieving filtered data of an entity
    q = Person.all()q.filter("last_name =", "Smith")
    q.filter("height <", 72)q.order("-height")

    results = q.fetch(5)
  • The GqlQuery interface is an SQL like query interface allowing the application to write queries to operate on the entities.
         q = db.GqlQuery("SELECT * FROM Person " +       
    "WHERE last_name = :1 AND height < :2 " +
    "ORDER BY height DESC",
    "Smith", 72)

    results = q.fetch(5)

Indexes

The process of generating and using indexes in the Google Data Store is transparent to the application developer. Here are some of the key aspects of the Indexing process:

  • An App Engine datastore maintains and uses an Index for every query that an application uses.
  • An Index is a table which contains the result for each query in the desired order
  • While the App Engine application can define its indexes in a configuration file the web server automatically changes this file based on execution patterns
  • The indexes are continuously updated as the queries are executed

The above aspects are sufficient to get started with the Google Datastore and start utilizing its key features. For understanding more details on how the Data Store works and some of the more detailed options refer the Google Documentation

From http://www.thetechtrendz.com/2010/07/understanding-basic-data-storage.html

Data (computing) Database Google (verb) app Relational database Data store Data storage Engine Google App Engine

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How To Set Up and Run Cypress Test Cases in CI/CD TeamCity
  • 4 Best dApp Frameworks for First-Time Ethereum Developers
  • MongoDB Time Series Benchmark and Review
  • A Beginner’s Guide To Styling CSS Forms

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: