August 16, 2023

Encryption is a way of scrambling data so that only authorized parties can understand the information.

The best time to establish protocols with your clients is when you onboard them.

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

What is QLDB?

Quantum Ledger Database (QLDB) is a No-SQL (Semi-SQL & Semi-NoSQL) Append-only database that provides an immutable, transparent, and cryptographically verifiable transaction log owned by a central authority. It can store a large amount of semi-structured data using a document-oriented data model because it is a No-SQL database. Furthermore, it employs a SQL-like data structure (Tables and Rows) and a language (PartiQL). As a result, it can leverage current SQL developers to provide robust ways to query and manage data.

Amazon QLDB is a fully managed ledger database with a central trusted authority that provides a transparent, immutable, and cryptographically verifiable transaction log. Amazon QLDB tracks every change to application data and keeps a complete and verifiable history of changes over time.

Terminologies Used:

Ledger:

An Amazon QLDB ledger database resource instance. In QLDB, this is the most common AWS resource type. A ledger contains both journal and indexed storage. After ledger data is committed to the journal, it is available for query in Amazon Ion document revision tables.

Journal:

The hash-chained collection of all blocks committed in your ledger. The journal is append-only and contains an immutable history of all changes to your ledger data.

PartiQL:

This is a brand-new open-source query language. PartiQL provides SQL-compatible access to the document-oriented data model of QLDB.

Ion:

It is a richly typed, self-describing, hierarchical data serialisation format that was created internally at Amazon. It is built on an abstract data model that supports both structured and unstructured data storage. Because it is a superset of JSON, any valid JSON document is also a valid Ion document.

Block:

A transactional object that is committed to the journal.

Digest:

A 256-bit hash value that represents your ledger’s entire history of document revisions as of a specific point in time.

Features of QLDB:

  • Immutability & Transparency

Amazon QLDB includes an immutable journal that records every data change in an accurate and sequential manner. The journal is append-only, which means that data can only be added to it and not overwritten or deleted. This prevents your stored change history from being deleted or modified. Even if you delete the data from your ledger, you can still access the change history of that data by reading from the immutable journal.

  • Audit Logs & History

You can access the entire change history of your application’s data using Amazon QLDB. You can request a summary of historical changes as well as specific transaction history details. As a result, QLDB can provide Audit trails right out of the box, with no additional configuration.

  • Verifiable

Amazon QLDB employs cryptography to generate a concise history of your change. A cryptographic hash function is used to generate this secure summary, also known as a digest (SHA-256). The digest serves as proof of your data’s change history, allowing you to go back in time and confirm the accuracy of your data changes.

  • Serverless & Highly Scalable

You don’t have to worry about provisioning capacity or configuring read and write limits with Amazon QLDB. You create a ledger and define your tables, and QLDB scales automatically to meet the needs of your application. It does, however, have some horizontal scaling limitations.

  • Easy to use

It gives developers a familiar SQL-like API, a flexible document data model, and full transaction support.

  • Streaming

QLDB’s streaming capability allows you to develop event-driven workflows, real-time analytics, and replicate data to other AWS services to support advanced analytical processing by providing a near real-time flow of your data stored within QLDB.

Comparison of QLDB with RDBMS:

Source: AWS Docs

How QLDB works?

Source: AWS Docs

In this article, we’ll look at how to use the PartiQL editor in the AWS console to create and query a QLDB.

Getting started:

First, sign in to AWS and navigate to Services: Amazon QLDB.

Then, in the QLDB Dashboard, click the “Create ledger” button.

A ledger will take about a minute to create. After you’ve created the ledger, go to the sidebar and select a newly created database from the Ledger dropdown.

Let’s go through the database and create, update, read, and delete student marks.

Create:

To store student grades in the database, we must first create a table. Let’s get started with PartiQL and make a table called “Students.” Here is the query for making a table.

It’s simple. As a result, we now have an empty table, Students. Let’s throw in a student’s grades. When the query is successful, it returns a unique documentId for each document stored.

Read:

We can return all of the students’ data from a table or just one student’s data based on a condition. Returning marks of a student named “Sweet Tooth”,” for example, or a returning student with Physics marks of 86.4

Update:

Now that you have data to work with, you can begin making changes to the data of your students. For example, suppose you mis-recorded Sweet Tooth’s Physics marks and wanted to change them from 86 to 100. The query below accomplishes this. You can also update the entire row of a record, as shown below.

Delete:

The DELETE statement can be used to delete specific student data from a table based on a predefined condition. For example, if you wanted to delete a student named “Sweet Tooth,” you can do so, or you can drop the entire table, as shown below.

Note: As long as the table exists, historical changes to the deleted document remain on the ledger.

History:

As previously stated, Amazon QLDB stores the entire history of every document in a table. Using the built-in history function, you can see all revisions of each student document you previously inserted, updated, and deleted. Each change to the document will be represented by a unique hash and version number, which can be easily verified and audited.

You should now have a basic understanding of the PartiQL syntax used by QLDB. See Amazon’s QLDB PartiQL Reference for more information on PartiQL operators, data types, and statements. We’ve only used the QLDB console so far, correct?

In the next article we’ll learn more about building a nodeJS application that can access our database, query, and update data.

CodeStax.Ai
Profile
August 18, 2023
-
6
min read
Subscribe to our newsletter
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Share this article:

More articles