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 🙏

© 2026 – Pkg Stats / Ryan Hefner

rds-pretty-query

v1.0.7

Published

Rds query prettier

Readme

rds-pretty-query

A command-line tool to execute queries against the RDS Data API via AWS CLI and format the output for readability.

Description

rds-pretty-query is a simple Node.js script that acts as a wrapper around the aws rds-data execute-statement command. It runs the AWS CLI command with the provided parameters and processes the JSON output, transforming it into a formatted, easy-to-read table directly in your terminal. It is particularly useful for quickly running SELECT queries and visualizing the results without having to handle raw JSON.

Prerequisites

Before using rds-pretty-query, ensure you have the following installed:

  • Node.js: Version 14 or higher.
  • AWS CLI: Configured with the correct credentials and region to access your RDS database.

Installation

Global Installation (Recommended for General Use)

If the package is published on npm (replace rds-pretty-query with the actual package name if different):

npm install -g rds-pretty-query

If you use Yarn:

yarn global add rds-pretty-query

Local Installation (For Development or Testing)

If you are working directly on the source code or want to test it locally before publishing:

  1. Clone the repository (if applicable).
  2. Navigate to the project's root directory where package.json is located.
  3. Run the npm link command to create a global symbolic link to your local package:
npm link

After global installation or linking, the rds-pretty-query command will be available anywhere in your terminal.

Usage

The rds-pretty-query command accepts the same arguments as the aws rds-data execute-statement command, with the guarantee that the --include-result-metadata flag is always included to enable output formatting.

The minimum required arguments are generally:

  • --resource-arn <your-database-arn>: The Amazon Resource Name (ARN) of your RDS database cluster or instance.
  • --secret-arn <your-secret-arn>: The ARN of the Secrets Manager secret containing the credentials to connect to the database.
  • --sql <your-sql-query>: The SQL query to execute.

Other common arguments include:

  • --database <database-name>: The name of the database to connect to within the cluster/instance.

General Syntax:

rds-pretty-query --resource-arn <arn> --secret-arn <secret-arn> --sql "<your-sql-query>" [other-aws-cli-arguments]

Example:

rds-pretty-query \
  --resource-arn arn:aws:rds:us-east-1:123456789012:cluster:my-database-cluster \
  --secret-arn arn:aws:secretsmanager:us-east-1:123456789012:secret:my-db-credentials-AbCdEf \
  --database mydatabase \
  --sql "SELECT id, name, created_at FROM users LIMIT 5;"

Example Output (Formatted):

📊 Results (5):

  id | name  | created_at
  ---|-------|------------
  • 1 | Alice | 2023-10-27
  • 2 | Bob   | 2023-10-27
  • 3 | Charlie | 2023-10-28
  • 4 | David | 2023-10-28
  • 5 | Eve   | 2023-10-29

If the command executes successfully but returns no records (e.g., INSERT, UPDATE, DELETE without RETURNING, or a SELECT with no matching rows), you will see a success message:

✅ Command run successfully. No results to display.

In case of errors (e.g., invalid SQL syntax, AWS authentication issues, aws command not found), the script will print the error message and exit with a non-zero code:

❌ Error executing the command (code 255):
An error occurred (BadRequestException) when calling the ExecuteStatement operation: syntax error at or near "SELECTT"

Testing

To run the unit tests for the script (requires Node.js v14+):

npm test

This will execute the tests configured in your package.json using Node.js's built-in test runner (node:test).

Contributing

Contributions are welcome! If you find a bug or have a suggestion for improving the script, feel free to open an issue or submit a pull request on the project repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

npm version