Skip to content

SQL-Vis/seeQL-npm

Repository files navigation

seeQLware

seeQLware is SQL query visualization middleware for Node.js. seeQLware allows users to test and visualize SQL queries using a connected PostgreSQL database.

Demo

View an example seeQLware interface with dummy data at https://seeql-app.herokuapp.com. This demo is set up with a default database that has three tables of data – songs, albums, and artists.

Project Requirements

  • Express server
  • PostgreSQL database
  • Node.js environment

Getting Started

Install Connect

$ npm install seeqlware --save-dev

Hook Up Your Project

Import seeQLware

In your server initiation file, require this library:

const seeql = require('seeqlware')

Import Your Database Instance

Ensure that your database is accessible from server initiation file. This might look like:

const db = require('../db')

Add seeQL Middleware Route

Add a route for your seeql visualization. This must be mounted on /seeql. The seeql middleware function (variable declared in import) takes your database as an argument.

app.use('/seeql', seeql(db))

Run Your App!

When you run your project, navigate to: http://your-home-route/seeql to get started with query testing and visualization!

Data Security

Before you deploy for production, remember to remove your seeql middleware. Alternatively, wrap your middleware route in a run environment conditional, for instance:

if (process.env.NODE_ENV !== 'production') {
  app.use('/seeql', seeql(db))
}

Use seeQLware

To submit a custom query, type a query into the form and click submit.

To view a sample query, select a sample query or prior custom query from the dropdown menu.

The results of the current query can be viewed in the results table. The key can be used for identifying denotations represented by icons in the schema diagram.

Supported Grammar

Currently, only select statements are supported. seeQL follows SQL grammar conventions for PostgreSQL. Enclose string values in single quotes, and enclose column names with uppercase letters in double quotes.

For example,

select songs.title, artists.age from songs right join artists on songs.artistId = artists.id;

would be correct, whereas

select title, age from songs right join artists on songs.artistId = artists.id;

would be incorrect.

Querying the column artistId from the table artists would look like "artistId".artists, and creating a join where the table songs' FK albumId is equal to the table albums' PK id woud look like songs."albumId" = albums.id.

People

seeQLware wouldn't exist without all the people involved!

The original authors of seeQLware are Riley Butterfield, Laura Campbell, and Vivian Xu.

Special thanks to Natalie Lane & Johnny O'Mara for their guidance on this project!

Want To Contribute?

Make a pull request here!