Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

109 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQLite Viewer

View SQLite file online directly in your browser.

The database will be loaded into your memory and changes will not affect the file you loaded it from. You can however export the database after making changes.

You can also load remote files (using JS ajax, remote server must send Access-Control-Allow-Origin:*) and prefill a SQL query using hash parameters:

  • To load a remote SQLite file upon page load, append
    #url=examples/Chinook_Sqlite.zip to the URL. Both absolute and relative URLs work. So do zipped files.
  • To prefill a SQL query, append
    #sql=SELECT%20*%20FROM%20table to the URL.
  • To load a remote file and prefill a query at the same time: Append both like this:
    #url=examples/Chinook_Sqlite.zip&sql=SELECT%20*%20FROM%20table

Try this live example!

Docker

You can run and configure the SQLite Viewer inside a lightweight production container using Docker.

1. Build the Docker Image

Execute the following build command in your workspace directory:

docker build -t sqlite-viewer -f docker/Dockerfile .

2. Auto-load a Database via Volume Mount

To mount your local database file or ZIP archive and have the application automatically fetch and load it on page load:

docker run --rm -p 8080:80 \
  -v "${PWD}/examples/Chinook_Sqlite.zip:/var/www/data.zip" \
  sqlite-viewer

Note: Navigate to http://localhost:8080 in your browser. The database tables will load instantly with zero user interaction.

3. Configure Default SQL Query & Database URL

You can specify a custom database URL and auto-execute a default SQL query on startup using environment variables:

docker run --rm -p 8080:80 \
  -e DEFAULT_URL="examples/Chinook_Sqlite.zip" \
  -e DEFAULT_SQL="SELECT name, type FROM sqlite_master WHERE type='table' ORDER BY name;" \
  sqlite-viewer
  • DEFAULT_URL: The database at this URL/path (relative path or absolute URL) will be fetched and opened on page load. Both raw databases and .zip archives are supported.
  • DEFAULT_SQL: The code editor will be pre-populated and this query will execute automatically on startup.

Libraries

License

Licensed under the Apache License, Version 2.0 — see LICENSE for details.