1. Home
  2. Training Library
  3. Google Cloud Platform
  4. Courses
  5. Data Management on Google Cloud Platform

Google Cloud Datastore for NoSQL databases

Start course
Overview
Difficulty
Beginner
Duration
27m
Students
697
Description

Data Management is critical for all server infrastructures - whether cloud-based or earth-bound. Even small applications need to process, manage, and digest large quantities of data, either as files, objects, or items in a database. So it's not surprising that all the major cloud platforms provide multiple data management solutions.

This course, designed and produced by our expert Linux System Administrator David Clinton, offers a great overview of the data solutions available from Google. You will see Google's two managed DBMS, its Object Storage service, and BigQuery - the Big Data service into which Google poured its years of experience performing analytics and queries on massive datasets.

Who should take this course

"Data Management on Google Cloud Platform" is a beginner level course, so it's available without any special prerequisites. Nevertheless, you might benefit by first going through our "Introduction to Google Cloud Platform" course for a more general view of the whole GCP family. Also, some experience with the Linux CLI might be helpful for those videos that include terminal operations.

After this course, you might want to try "Getting Started with Google Compute Engine",to round out your GCP knowledge. And after that, check out our Google quiz questions: Test yourself and increase your understanding at the same time thanks to our exclusive learning technology.

 

Transcript

Hi, and welcome to CloudAcademy.com's video series on Google Cloud Platform Data Management. In this video we're going to explore the Google Datastore. That is Google's managed, scalable, schemaless database with SQL-like queries, and built in redundancies.

Enable Google Datastore API

To get started we'll first have to enable to Google Datastore API in our project. Assuming we're in the correct project, which in our case is known as futuregraph718, click on APIs and authentication, then on APIs, and then make sure that the Google Cloud Datastore API is enabled. In this case it is. If it's not enabled you may find it down here among the list of disabled APIs. But in our case it's already enabled. Now let's open up a terminal on our local computer and we'll create a compute instance. Now we assume you've already installed the gcloud SDK as we have on this computer. First we'll create a couple of variables, the variable known as projectID will equal futuregraph718 which is the name of the project ID of our project.

We'll create the variable instancename and that will be mydata. And now, we'll use gcloud to actually create the instance with the name mydata associated with the project futuregraph718. In addition it will have Datastore as it's scopes. We are offered a choice of which region, or actually which zone we'd like to make this instance a part of. And we'll choose number six which is US Central 1A. That seems to have worked. Let's now SSH into that instance. We're in. Now we have some serious work to do building up the instance to have the profile we're after.

How to install Google Datastore with pip

First, let's run sudo apt-get update. Before we can add any software we have to first tell the system what software is available through the repositories.

Now let's add some software, Python PIP which is the Python package manager, Python dev, and a library called libssl-dev, virtual envelope wrapper, and a couple of small utilities, wget and unzip which we're going to use as part of the installation process. Yes we want to continue. Let's now use virtual envelope to introduce us to the Google Cloud Datastore environment. And now, we'll use PIP which again is the Python package manager, to install Google Datastore.

Now we'll use wget, which simply retrieves the contents of a particular website and saves them into the current directory, to get the v1beta2revision12.11.zip file from the Google Cloud Platform Github repository. Now we'll unzip, using the unzip package extraction utility that we installed previously, the v1beta2 zip file. That's done. We'll now use the PIP package manager again to install and install recursively the whole Google Cloud Datastore package.

Google Datastore structural overview

That seems to be done. We are fully installed. Now let's go through a very, very brief structural overview of Google Datastore's workings from a Python perspective. You're looking at a sample snippet that I borrowed from the Google Cloud documentation, by the way. Your application, in this case Python, will create entities, which are objects with data values stored as properties. Your application can execute queries over entities. Each entity, which is identified by a unique key, will have one or more properties, values for instance string, integer, or a reference to another entity.

You can perform transactions made up of one or multiple operations, but no one operation can succeed unless every operation succeeds. A Python application uses NDB, NDB by the way stands for Network Database, to define a class or a model, kind of like a database schema. In other words, describing the properties.

Type checking via models by the way is possible, but not necessary. This sample code defines the class or model greeting up there. Each greeting entity has two properties, the text context of the greeting, in this case string, and the date the greeting was created. To create and store a greeting, the application creates a new greeting object and calls it's put method. In this example also borrowed from Google's documentation, there's one entity in the Datastore for each customer, and one entity in the Datastore for each purchase. With a key property that points to the customer, the query will find all purchases associated with the customer.

About the Author
Avatar
David Clinton
Linux SysAdmin
Students
11905
Courses
12
Learning Paths
4

David taught high school for twenty years, worked as a Linux system administrator for five years, and has been writing since he could hold a crayon between his fingers. His childhood bedroom wall has since been repainted.

Having worked directly with all kinds of technology, David derives great pleasure from completing projects that draw on as many tools from his toolkit as possible.

Besides being a Linux system administrator with a strong focus on virtualization and security tools, David writes technical documentation and user guides, and creates technology training videos.

His favorite technology tool is the one that should be just about ready for release tomorrow. Or Thursday.