Giter VIP home page Giter VIP logo

bashql's Introduction

BashQL

BashQL (Bash Query Language) is a database management system (dbms) and database engine rolled into one. Very quick setup and transparent: databases are set up locally in the BashQL install directory. Easy to back up and ship elsewhere.

Note: It's a work in progress, keep in mind that the storage format can still change. The nightly build is dark and full of terrors.

Features

* SQL-like syntax on the commandline, like:
	* --show --databases
	* --show --tables
	* --describe=<table_name>
	* --select=* --from=<table_name> --id=<id>
* Runs completely on bash
* Output can be JSON or a table format
* Only three dependencies: grep, awk and jq.
* Create/update/drop databases and tables
* Insert / update / delete records
* Supports search and fetch by ID

Dependencies

* awk
* grep
* jq (for json support)

Get started

# Pull repo
git pull [email protected]:koffiebaard/ish.git

# install (== put symlinks in ~/.local/bin, check dependencies)
./install.sh

# source your profile for autocomplete to work
source ~/.bash_profile

# Confirm everything works
bql --test

# Check again, just to be sure
bql --rawr

Documentation

The help function is up to date:

bql help function

Examples

# Create database
$ bql --create --database=test
OK

# Select database
$ bql --use=test
OK

# Create table
$ bql --create --table=tabletest --columns='table text, chair text, awesome int'
OK

# Show table info (incorrect table name)
$ bql --describe=tabletesTTT
Error: Table "tabletesTTT" does not exist.

# Show table info (incorrect database name)
$ bql --describe=cake.tabletest
Fatal: Database "cake" doesn't exist.

# Show table info (default is json)
$ bql --describe=tabletest
[
  {
    "name": "id",
    "type": "text"
  },
  {
    "name": "table",
    "type": "text"
  },
  {
    "name": "chair",
    "type": "text"
  },
  {
    "name": "awesome",
    "type": "int"
  }
]

# Show table info (in table format)
$ bql --describe=tabletest --tabular

| name         | type
=======================
| id           | text
| table        | text
| chair        | text
| awesome      | int

# Insert record into table
$ bql --insert --into=tabletest --table="Flattened oak tree" --chair="Unflattened pine blob" --awesome=9001
15c0a959-4167-474b-b963-79f17a1f0713

# select from table, in table format
$ bql --select=* --from=tabletest --tabular

| awesome      | chair                      | id                                        | table
==========================================================================================================
| 9001         | unflattened pine blob      | 15c0a959-4167-474b-b963-79f17a1f0713      | Flattened oak tree

Contributing

Feel free to contribute! Ping me or send a pull request and let's go.

License

BashQL is under the MIT license, but without me shipping the copyright text with the project. That's too much effort.

bashql's People

Contributors

koffiebaard avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.