Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to Google Cloud Datastore - #GDGSV

Intro to Google Cloud Datastore - #GDGSV

Intro to Google Cloud Datastore.

Learn the basics of Google Cloud Datastore, a fully managed, NoSQL database that makes storing data in the cloud easy!

Presentation given at the Google Developer's Group of Silicon Valley on 5/6/2015.

http://www.meetup.com/gdg-silicon-valley/events/222174819/

https://github.com/thesandlord/samples/tree/master/google-cloud-datastore/cli-forum

Sandeep Dinesh

May 06, 2015
Tweet

More Decks by Sandeep Dinesh

Other Decks in Programming

Transcript

  1. • Developer Advocate @ Google • Full-Stack Web • Founded

    an IoT Startup • First talk at Google! • @sandeepdinesh github.com/thesandlord [email protected] About me
  2. • Relational Data • Complex Queries • Track Record The

    old guard RDBMS - Relational Databases Images from Wikipedia
  3. Fully Managed NoSQL ACID Built for Scale High Replication High

    Availability Google Cloud Datastore Google’s DBAs are your DBAs No software upgrades/patches No pager duty :)
  4. Fully Managed NoSQL ACID Built for Scale High Replication High

    Availability Google Cloud Datastore Semi-Structured Data Easy to Use Powerful Query Abilities
  5. Fully Managed NoSQL ACID Built for Scale High Replication High

    Availability Google Cloud Datastore Atomic Transactions (Eventual) Consistency Reliable
  6. Fully Managed NoSQL ACID Built for Scale High Replication High

    Availability Google Cloud Datastore Built for Google Scale Scalable Design, By Design
  7. Fully Managed NoSQL ACID Built for Scale High Replication High

    Availability Google Cloud Datastore Asteroid Proof 99.95% uptime
  8. Section Slide Template Option 2 Put your subtitle here. Feel

    free to pick from the handful of pretty Google colors available to you. Make the subtitle something clever. People will think it’s neat. Using Datastore Getting Started with Infinite Scale
  9. Datastore Introduction Terminology Datastore RDBMS Category of Object Kind Table

    One entry/object Entity Row Unique identifier of data entry Key Primary Key Individual piece of data inside entry/object Property Field
  10. Terminology Eventual Consistency Data Center 1 Data Center 2 User

    1 New Data User 2 User 3 Old Data New Data New Data
  11. Terminology Strong Consistency Data Center 1 Data Center 2 User

    1 New Data User 2 User 3 Locked Locked New Data New Data
  12. Terminology Eventual Consistency vs Strong Consistency Common Types of Queries:

    Global Queries Key Queries Ancestor Queries Eventually Consistent Strongly Consistent Strongly Consistent
  13. Code Scenario Let’s build a message board Full Code w/

    ncurses UI: github.com/thesandlord/examples/datastore/ All code I am going to write is Copyright Google and Licensed under Apache v2
  14. Code Setup Terminal $ pip install --upgrade gcloud $ pip

    install --upgrade google-api-python-client
  15. Code Oh no it broke :( Query with Multiple Filters

    need special Indexes! query = datastore.Query(kind='Comment', filters=[('storyid', '=', obj["id"])], order=['timestamp']) gcloud.exceptions.PreconditionFailed: 412 no matching index found.
  16. Code Create Some Indexes! We need to use the gcd

    tool https://cloud.google.com/datastore/docs/downloads#tools gcd.sh create ./temp mv temp/WEB-INF . rm -r temp/ #Create Index XML File (next slide) gcd.sh updateindexes --auth_mode=oauth2 . Follow the prompts
  17. Code datastore-indexes.xml XML <?xml version="1.0" encoding="utf-8"?> <datastore-indexes autoGenerate="true"> <datastore-index kind="Comment"

    ancestor="false"> <property name="storyid" direction="asc"/> <property name="timestamp" direction="asc"/> </datastore-index> </datastore-indexes>