npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

db-repl

v0.2.1

Published

sql repl based on knex

Downloads

2

Readme

db-repl

  • run queries in MSSQL, PostgreSQL, MySQL, MariaDB, SQLite3
  • visualize columns on terminals
  • format to CSV, Markdown, JSON

Instructions

  • set database names with # (example: #db1 SELECT * FROM tbl1)
  • set formats with @ (example: @csv SELECT * FROM tbl1)
  • available formats @visual, @csv, @md, @json

Installation

  • install npm install -g db-repl
  • create an array of knex configs in your $HOME/.db-repl.js please visit https://knexjs.org
  • exit: CTRC-C x 2

Examples

setup and run:

$> echo "module.exports = [{client:'mssql',connection:{host:'127.0.0.1',user:'your_database_user',password:'your_database_password',database:'myapp_test'}}];" > $HOME/.db-repl.js
$> db-repl

set db and run query:

ø> #your_database_user SELECT 1 AS a, 2 AS b
=== your_database_user ===

 # a  b
-- -- --
#0 1  2
true

split columns in @visual mode:

ø> @visual SELECT 1 test1, 2 test2, 3 test3, 4 test4, 5 test5, 6 test6, 7 test7, 8 test8, 9 test9, 10 test10, 11 test11, 12 test12, 13 test13, 14 test14, 15 test15
=== db2 ===

 # test1 test2 test3 test4 test5 test6 test7 test8 test9 test10
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ------
#0 1     2     3     4     5     6     7     8     9     10


 # test11 test12 test13 test14 test15
-- ------ ------ ------ ------ ------
#0 11     12     13     14     15
true

set CSV and run query:

ø> @csv SELECT 1 AS a, 2 AS b
Changing currentFormat to csv
=== your_database_user ===

"a","b"
"1","2"
true

set Markdown and run query;

ø> @md SELECT 1 AS a, 2 AS b
Changing currentFormat to md
### your_database_user

a | b
:-- | :--
1 | 2
true

run multiple queries (split by ;)

ø> SELECT 1 AS a, 2 AS b; SELECT 4 AS c, 5 AS d
### your_database_user

a | b
:-- | :--
1 | 2
### your_database_user

c | d
:-- | :--
4 | 5
true

change db and format

ø> #db2
Changing currentDb to db2
true

ø> @json
Changing currentFormat to json
true

select with @json format

ø> SELECT 1 AS a, 2 AS b
Changing currentFormat to json
/* === db2 === */
[
    {
        "a": 1,
        "b": 2
    }
]
true