24Apache Ignite in Python

This chapter's example uses Python to build a NoSQL key-value database. The example runs on the local computer, but it shouldn't be hard to adapt it to run in the cloud.

This example is much less complicated than the examples described in the previous chapters, largely because a key-value database has fewer features. Relational, graph, and document databases all provide sophisticated querying features. In contrast, a key-value database mostly just stores values and later retrieves them.

Apache Ignite can actually function as a relational database, but Chapters 16 through 19 demonstrated that kind of database, so this chapter uses only Ignite's key-value features.

A key-value database lets you associate a piece of data with a key and then later use the key to retrieve the data.

You can compare a key-value database to your computer's environment variables. You can set an environment variable and give it a name. Later, you can get that variable by its name.

For example, to set the environment variable named GREETING in Windows, you can open a console window and enter the following command.

SET GREETING=Howdy Pard!

Later, you can use the following code to show the saved value:

ECHO %GREETING%

A program can use code to do something similar. For example, the following code shows how a Python program might display the variable that you set in the command window:

import os
print(os.getenv('GREETING'))

The following code shows the C# version:

Console.WriteLine(Environment.GetEnvironmentVariable("GREETING")); ...

Get Beginning Database Design Solutions, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.