A Node.js web app for writing and running SQL queries and visualizing the results. Supports Postgres, MySQL, SQL Server, Crate and Vertica.
SqlPad is meant to be run on an internal network for a single team. All connections added to the app can be used by all individuals with access to the SqlPad server. All queries written can be run and edited by everyone on the server.
If you want to be bold and daring, you can expose your SqlPad instance to the outside world. Please make sure you fully understand the risks associated with doing this and use SSL.
First, install Node.js and then
npm install sqlpad -g
For more info visit the project page at http://rickbergfalk.github.io/sqlpad/.
If you have highlighted just part of your query, only that part will be executed when you click Run Query.
By default SqlPad will listen from all available addresses (0.0.0.0). This may be overridden via the --ip
flag or the SQLPAD_IP
environment variable.
By default SqlPad will use port 80. This may be overridden via cli parameter --port
or environment variable SQLPAD_PORT
.
By default SqlPad will be accessible from the absolute base path of the available IP address(es). This may be overridden via cli parameter --base-url
or environment variable SQLPAD_BASE_URL
.
SqlPad uses very simple encryption when storing database connection passwords. A custom encryption passphrase may be set via cli parameter --passphrase or environment variable SQLPAD_PASSPHRASE.
To change the maximum records returned by a SQL query, add a new item with key queryResultMaxRows
and set the value to the max number of rows you would like returned. If the key is missing or set to a non-number, SqlPad will return a maximum of 50,000 rows.
To disable CSV downloads, visit the "Configuration" page and add a new item with key allowCsvDownload
and value false
. If the key is missing or set to any other value, CSV downloads will be enabled.
Some databases (like Vertica) require the fully qualified table and column names within a SQL statement. This can be a hassle to remember or type when you have long and complicated names. For convenience, you can enable fully-qualified-name copy buttons that appear in the schema sidebar. When hovering over an item in the schema tree, a copy button will appear. Click it and the schema name, table name, and column name will be copied to your clipboard.
To enable the schema copy buttons, add a new configuration item with key showSchemaCopyButton
with value true
.
If you want to hack on SqlPad, here's a guide as to what my workflow has been like:
First clone or download this repo. Then install dependencies.
npm install
Some scripts are already provided in the package.json file to get started quickly.
npm start
will run a sqlpad instance with some basic parameters for development.
npm run bundle
will run browserify and bundle the client-side javascript files.
If you'd like to provide different command line parameters to sqlpad while developing you can do so by passing them to server.js directly. For example:
node server.js --dir ./db --port 3000 --debug
While developing, it might be useful to use nodemon
or watchify
to monitor directories and restart/rebundle on file changes.
MIT