A web app which can be used to query one or more SQL databases.
- Query
- Execute queries
- Autocomplete keywords, table names, columns
- Configure autocomplete of frequently used join statements
- Configure autocomplete of frequently used table aliases
- Save to file/clipboard
- Executing saved queries from GitHub
- Cell links.
- Graph results (WIP)
- Share queries via URL
- View database details
- List databases
- List tables
- View table stats
- View column details
- View index details
- Export metrics to Prometheus (WIP)
- Report errors to Airbrake
See development_config.yml for an example.
# App Configuration
name: SQLUI # Server display name to be used in the UI.
port: 8080 # App port.
environment: development # App environment.
base_url_path: /sqlui # URL path used as the base for all app URLs.
# Database Configurations
databases: # Map of database configurations.
seinfeld: # Database configuration name.
display_name: Seinfeld # User-facing name.
description: A database about nothing. # User-facing description.
url_path: seinfeld # Relative URL path used to access this database.
# Connection Configuration
client_params: # Params for the MySQL client.
database: seinfeld # Optional database name.
username: newman # Database username.
password: drakescoffeecake # Database password.
port: 3306 # Database port.
host: 127.0.0.1 # Database host.
# Saved File Configuration
author: # Details used when authoring a commit.
name: 'SQLUI'
email: [email protected]
token: ghp_SomEt0k3N # GitHub personal access token with "repo" scope.
owner: nicholasdower # Repo owner.
repo: sqlui # Repo name.
branch: master # Branch.
regex: ^sql/.*[.]sql$ # Regex used to match files.
# Table Configurations (Optional)
tables: # Map of table configurations.
characters: # Table name.
alias: c # Default table alias.
boost: 1 # Auto-complete boost. -99 to 99.
[...]
# Column Configurations (Optional)
columns: # Map of column configurations.
name: # Column name.
links: # Optional map of cell links.
google: # Link configuration name.
short_name: G # Link short name. Displayed within the cell.
long_name: Google # Link long name. Displayed on hover.
template: google.com/search?q={*} # Link URL. Use {*} as a placeholder.
[...]
# Join Configurations (Optional)
joins: # Map of join configurations.
actors_to_charactors: # Join configuration name.
label: 'actors to characters' # Join label. Displayed in autocomplete dropdown.
apply: 'actors a ON a.id = c.actor_id' # Join statement.
[...]
[...]
gem install 'sqlui'
or
gem 'sqlui'
sqlui <config-file>
or
bundle exec sqlui <config-file>
By default all building, running and testing is done in Docker containers.
See https://docs.docker.com/get-docker/
make start
Visit http://localhost:8080/sqlui
make test
It is also possible to run the server and unit tests without Docker. Docker is still used for MySQL and browser tests.
See https://rvm.io/rvm/install
rvm install ruby-3.0.0
rvm use
See https://github.com/nvm-sh/nvm#installing-and-updating.
nvm install 19.0.0
nvm use
make start-local
Visit http://localhost:8080/sqlui
See https://chromedriver.chromium.org/getting-started
make test-local