Giter Club home page Giter Club logo

neodba's Introduction

Neodba

NOTE: This is alpha-quality software, full of rough edges and severely lacking in features.

Neodba is a simple, depedency-free CLI tool for interacting with databases.

Rationale

The main reason I wrote this app is to serve as the sole dependency of this Neovim plugin. To meet this requirement the Neodba binary is a single, static, native executable. I.e. even though Neodba is written in Clojure it has no runtime requirements, including the JVM nor even libc.

Installation

NOTE: only Linux x64 architecture is supported for now.

Simply grab the binary from the Releases page and extract it to a location in your PATH, e.g.:

tar -xf neodba-VERSION-x86_64-linux.tar.gz
sudo mv neodba /usr/bin

Usage

Config

Create a file named db-spec.edn to specify how to connect to your database. This file must be in the current working directory when running neodba. See db-spec.edn for a Postgresql example. For complete documentation look here.

Sub-commands

e, eval

Evaluates the following arguments as a SQL statement. In the example below the single quotes are used to avoid having to escape the asterisk as it's a special shell character:

neodba e 'select * from some_table'

There are a few helpers to retrieve database metadata such as the following:

neodba e '(get-database-info)'
neodba e '(get-catalogs)'
neodba e '(get-schemas)'
neodba e '(get-tables)'
neodba e '(get-views)'
neodba e '(get-columns some_table)'
neodba e '(get-functions)'
neodba e '(get-procedures)'

f, file

Evaluate SQL in the given file, e.g.:

neodba f some-file.sql

r, repl

Starts a REPL where you can enter SQL statements. It is recommended to run Neodba with rlwrap to get proper readline support (history, arrow keys, etc.):

rlwrap neodba r

Database Support

Postgresql is currently the only supported database.

Since, at this stage, Neodba is essentially a POC, I didn't want to put the effort into supporting any additional databases. Though in theory it should be quite easy to add additional databases since the communication is done via JDBC. I.e. it should be as easy as including additional JDBC drivers.

Development

References

  • next-jdbc (a Clojure JDBC wrapper) is the primary interface to the database
  • The DatabaseMetaData interface is leveraged to provide database metadata such as available tables, table columns, available functions, etc.

neodba's People

Contributors

thiru avatar

Watchers

 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.