Skip to main content

A basic CLI for interacting with Amazon QLDB

Project description

Amazon QLDB Shell

This tool provides an interface to send PartiQL statements to Amazon Quantum Ledger Database (QLDB). This tool is not intended to be incorporated into an application or adopted for production purposes. The objective of the tool is to give developers, devops, database administrators, and anyone else interested the opportunity for rapid experimentation with QLDB and PartiQL.

Prerequisites

Basic Configuration

See Accessing Amazon QLDB for information on connecting to AWS.

Python 3.4 or later

The shell requires Python 3.4 or later. Please see the link below for more detail to install Python:

Getting Started

Install the QLDB Shell using pip:

pip3 install qldbshell

Invocation

The shell can then be invoked by using the following command:

$ qldbshell --region <region_code> --ledger <ledger_name>

An example region code that can be used is us-east-1. The currently avaiable regions are addressed in the QLDB General Reference page. By default, the shell will use the credentials specified as environment variables and then in the default profile mentioned in ~/.aws/credentials/ (default location set in the AWS_SHARED_CREDENTIALS_FILE environment variable) and then the default profile in ~/.aws/config (default location set in AWS_CONFIG_FILE environment variable). Various optional arguments can be added to override the profile, endpoints, and region used. To view the arguments, execute the following:

$ qldbshell --help

Example Usage

Assuming that the ledger, "test-ledger" has already been created:

$ qldbshell --region us-east-1 --ledger test-ledger
qldbshell> CREATE TABLE TestTable
qldbshell> INSERT INTO TestTable `{"Name": "John Doe"}` 
qldbshell> SELECT * FROM TestTable
qldbshell> exit

We use backticks in the example above since we use are using Ion literals. For more on querying Ion literals, go here. Each statement except exit is considered as a transaction.

See also

  1. Amazon QLDB accepts and stores Amazon ION Documents. Amazon Ion is a richly-typed, self-describing, hierarchical data serialization format offering interchangeable binary and text representations. For more information read the ION docs.
  2. Amazon QLDB supports the PartiQL query language. PartiQL provides SQL-compatible query access across multiple data stores containing structured data, semistructured data, and nested data. For more information read the PartiQL docs.
  3. We use backticks in our example since we use are using Ion literals. For more on querying Ion with PartiQL, go here.

Development

Setting up the Shell

Clone the repository using:

git clone --recursive https://github.com/awslabs/amazon-qldb-shell.git

After cloning the repository, activate a virtual environment and install the package by running:

$ virtualenv venv
...
$ . venv/bin/activate
$ pip3 install -r requirements.txt
$ pip3 install -e .

License

This tool is licensed under the Apache 2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qldbshell-1.2.0.tar.gz (68.1 kB view details)

Uploaded Source

File details

Details for the file qldbshell-1.2.0.tar.gz.

File metadata

  • Download URL: qldbshell-1.2.0.tar.gz
  • Upload date:
  • Size: 68.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for qldbshell-1.2.0.tar.gz
Algorithm Hash digest
SHA256 4daeeabc3f8aa2d501939494d61f298749cb6385fc4bce63c74faa537dda449e
MD5 5e8a441a3e8f1f27272c3b6ad2bf4f55
BLAKE2b-256 0ff7fe984d797e0882c5e141a4888709ae958eb8c48007a23e94000507439f83

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page