Skip to content

davidgasquez/sqline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQLine

Build Status

Command line tool to perform SQL database queries. With sqline you can mix the power of Unix tools with the power of SQL.

Installation

To install sqline, simply:

pip install sqline

Requirements

You need to set the following environment variables:

  • DB_USER
  • DB_PASSWORD
  • DB_ENDPOINT
  • DB_NAME
  • DB_PORT
  • DB_DIALECT: Engine and driver for SQLAlchemy.

Usage

Making a simple query is easy as running sqline "select * from users limit 10". One you're happy with your query you can get the entire result in JSON or CSV. Is also possible to get the input from a file. For example, having query.sql:

SELECT
    user,
    age,
    country
FROM users
WHERE age > 25

Running cat query.sql | sqline -o json will give a set of new line delimited JSONs. You can plug any existing Unix tool to the output, for example jq for the JSON output (cat query.sql | sqline -o json | jq .country | uniq -c).

Contributions are welcome!

About

🛠️ Simple command line tool to query databases

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages