Skip to main content

Introduction and Usage Examples

A command line tool for any database can greatly simplify quite a few data management tasks. ApertureDB client ships with a command line utility to support some common functions.

It's design goals are to:

  • Reduce boiler plate code for simple tasks.
  • Be extensible for arbitrary use cases.

Introduction

adb command line tool lets you:
  • Configure and manage multiple ApertureDB server connection profiles
  • Ingest data from CSV (comma separated value) files while setting up your ETL pipelines
  • Use data generators while ingesting this data
  • Apply transformations as part of data ingestion
  • Update existing metadata and data
  • Execute native queries, and
  • Invoke common utility methods.

It is automatically installed when the ApertureDB client is installed via pip.

tip

To make it more useful, execute adb --install-completion before anything else

For a complete command line reference, please see documentation.

Common Usage Examples

adb config

To connect to an instance of ApertureDB, we need to specify where and how to connect. This information is collectively refered to as a connection configuration, or config.

The following adb sub commands help with config management.

List all the configs a user has created

adb config ls

Create a config named local

adb config create local

We often need to try things in a sandbox or a local environment, before a production run.

adb config activate facilitates switching between different database instances. This way, we can debug things with code using ApertureDB python sdk with config pointing to a local instance, and once it is satisfactory, activate a production config, and rerun the same code.

Activate one of the configs from the list

adb config activate local --as-global

adb ingest

adb supports 2 out of 3 ingest mechanisms available to load data into an instance of ApertureDB.

Let's assume your data has been saved into a CSV file called hello.csv. Then to ingest, you can run:

adb ingest from-csv hello.csv

Alternatively, assuming that you implement a data generator named hello.py. This is how you could put all the data into ApertureDB.

adb ingest from-generator hello.py

adb transact

If there is a JSON query like any one from these examples saved as a json file named person.json, then it could be run against ApertureDB as follows:

adb transact from-json-file person.json

adb utils

Simple things like getting the DB status, summary, purging all the data, or removing all the indices can be accomplished using commands like:

adb utils execute status
adb utils execute summary
adb utils execute remove_all
note

Auxillary uses of adb.

  • It's a reference of how to build applications using python sdk.
  • Commonly (re)used database operations packaged as a CLI

adb source code.

A complete reference to adb options.