Code Monkey home page Code Monkey logo

sqlpad's Introduction

SQLPad

Build Status

A web app for writing and running SQL queries and visualizing the results. Supports Postgres, MySQL, SQL Server, Crate, Vertica, Presto, and SAP HANA. Other databases potentially supported via unix odbc support.

Version 3 Work in progress

Version 3 work has been promoted to master branch and is functional but not ready for release.

This work involves a directory restructuring and a front-end react component framework migration from react-bootstrap to antd.

Version 3 will not contain any breaking back-end changes. It should be possible to try v3 out with a given SQLPad database, and revert back to v2 if desired.

Installation, Usage, Screenshots

Visit project page at http://rickbergfalk.github.io/sqlpad/.

SQLPad Query Editor

Using Docker Image

The docker image runs on port 3000 and uses /var/lib/sqlpad for the embedded database directory.

Some configuration is exposed via environment variables. See configItems.js for details on environment variables considered (envVar field).

See docker-validation folder for example docker-compose setup with SQL Server.

Building

  • Clone/download this repo

  • Install node 8 or later (nvm recommended)

  • Ensure you have the latest npm

    npm install npm -g
  • Install dependencies and build the UI

    scripts/build.sh

At this point you can run the SQLPad server with the frontend built for production use:

cd server
node server.js --dir ../db --port 3010 --base-url '/sqlpad'

If prefered, SQLPad can be installed as a global module using the local files in this repo. This allows running SQLPad via the cli in any directory, just as if you had installed it with npm install sqlpad -g

cd server
node install -g

# Now from somewhere else you can run sqlpad like
cd ~
sqlpad --dir ../db --port 3010 --base-url '/sqlpad'

A docker image may be built using the Dockerfile located in server directory. See docker-publish.sh for example docker build command.

Development

  • Clone/download this repo

  • Install node 8 or later (nvm recommended)

  • Ensure you have the latest npm

    npm install npm -g
  • Install dependencies and build the UI

    scripts/build.sh
  • Open 2 terminal sessions in the root of this repo.

    In one install the backend dependencies and start the development server

    npm start --prefix server

    In the other install frontend dependencies and start the devleopment server

    npm start --prefix client

At this point you should have both backend and frontend development servers running.

http://localhost:3000 serves React-based frontend in dev-mode
http://localhost:3010 serves frontend compiled for production

When viewing the frontend in development mode, the page will automatically refresh on frontend file change. The backend server will auto-restart on backend file change.

ESLint and Prettier are used to enforce code patterns and formatting in this project. A precommit hook should enforce and warn about these checks. If that is not set up however you may find these terminal commands useful.

# To check lint
npm run lint

# To fix (some) errors and formatting automatically
npm run fixlint

Optional step

A docker-compose file with is provided to provide an empty postgres database to test with. If you have docker installed, in a third terminal session you can do the following:

# Bring database containers up in background
docker-compose up

# control-c will stop the databases in docker compose

# If you would like to run this in the background, run
docker-compose up -d

# To bring database down from background
docker-compose down

# To remove dangling containers volumes etc
docker system prune

To connect to the database within SQLPad during development use the following settings:

driver: postgres
host: localhost
database: sqlpad
username: sqlpad
password: sqlpad

License

MIT

sqlpad's People

Contributors

rickbergfalk avatar willwest avatar vweevers avatar nbrustein avatar cgivre avatar dcelasun avatar dudemelo avatar kochamcie avatar esamattis avatar jameswinegar avatar marcmillien avatar 22222 avatar adrienbrault avatar brysgo avatar daveloyall avatar joshdvir avatar johicks avatar razumau avatar naereen avatar mlebee avatar nikicat avatar askluyao avatar clach04 avatar developersteve avatar greigwise avatar

Watchers

James Cloos avatar  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.