Cross-platform client for PostgreSQL databases

pgweb

Web-based PostgreSQL database browser written in Go.

Release Linux Build Windows Build Go Report Card GoDoc Docker Pulls

Overview

Pgweb is a web-based database browser for PostgreSQL, written in Go and works on OSX, Linux and Windows machines. Main idea behind using Go for backend development is to utilize ability of the compiler to produce zero-dependency binaries for multiple platforms. Pgweb was created as an attempt to build very simple and portable application to work with local or remote PostgreSQL databases.

See application screenshots

Features

  • Cross-platform support OSX/Linux/Windows 32/64-bit
  • Simple installation (distributed as a single binary)
  • Zero dependencies
  • Works with PostgreSQL 9.1+
  • SSH Connections
  • Multiple database sessions
  • Simple database browser
  • Execute and analyze custom SQL queries
  • Table and query data export to CSV/JSON/XML
  • Query history
  • Server bookmarks

Visit WIKI for more details

Pgweb Pro

Pgweb Pro is the next major version of Pgweb and includes features like:

  • Table structure editing
  • Data editing (update row content)
  • Charting
  • History persistence
  • Multiple tabs

Please get in touch via: https://goo.gl/forms/euQOGWg5uPdPH70b2

Demo

Visit https://pgweb-demo.herokuapp.com to see pgweb in action.

Installation

Usage

Start server:

pgweb

You can also provide connection flags:

pgweb --host localhost --user myuser --db mydb

Connection URL scheme is also supported:

pgweb --url postgres://user:password@host:port/database?sslmode=[mode]
pgweb --url "postgres:///database?host=/absolute/path/to/unix/socket/dir"

Multiple database sessions

To enable multiple database sessions in pgweb, start the server with:

pgweb --sessions

Or set environment variable:

SESSIONS=1 pgweb

Deploy on Heroku

Heroku Deploy

Testing

Before running tests, make sure you have PostgreSQL server running on localhost:5432 interface. Also, you must have postgres user that could create new databases in your local environment. Pgweb server should not be running at the same time.

Execute test suite:

make test

If you're using Docker locally, you might also run pgweb test suite against all supported PostgreSQL version with a single command:

make test-all

Contribute

  • Fork this repository
  • Create a new feature branch for a new functionality or bugfix
  • Commit your changes
  • Execute test suite
  • Push your code and open a new pull request
  • Use issues for any questions
  • Check wiki for extra documentation

License

The MIT License (MIT). See LICENSE file for more details.

Owner
Dan Sosedoff
Software engineer at Hashstack LLC
Dan Sosedoff
Comments
  • Integrate with an existing website

    Integrate with an existing website

    Hi, I'm trying to integrate pgweb with an existing website (hosted on aws beanstalk with nodejs, within a load balanced environment). I want to have a button on the website which opens up the "database explorer", bypassing the pgweb login page as I already have those credentials in the nodejs server hosting the website (and in fact, the user might not even know the credentials to the database, only the credentials to the website).

    Currently, the only way for bypassing the login page, from what I understand, is by specifying it in the command line when spinning up the pgweb server, right? Which means that I'll need to spin up a server by demand for each user, and on a different port for each user? So this is not a practical solution (especially with regards to configuring all of the port forwarding rules).

    Is there any better way for supporting this scenario?

    2 potential solutions:

    1. Support passing connection bookmarks in the url for an existing pgweb server, and not just on startup. So I'll be able to spin up a single pgweb server in advance. Related to #204 .
    2. Ideally, I would want to have pgweb as a library in my existing server, and not to spin up an additional server. So for a specific sub-domain I will forward the request to pgweb (with an option for me to hook to the output before rendering, for example for giving better matching colors for my website).

    Thanks.

  • Error: Database does not have any tables ... but it does

    Error: Database does not have any tables ... but it does

    I am trying to connect to a database running on another machine on the network. When I connect with pgAdmin it works perfectly, so I know that it should work.

    I try to run pgweb with the following command:

     pgweb_windows_amd64.exe /url:"postgres://vagrant:[email protected]/mydbname"
    

    Here is the error that it returns:

    Connecting to server...
    Checking tables...
    Error: Database does not have any tables
    

    I turned on connection logging on the server, and here is what I got:

    2014-10-29 01:11:30 GMT 54503ec2.7ee9 vagrant mydbname LOG:  statement: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' ORDER BY table_schema,table_name;
    2014-10-29 01:11:30 GMT 54503ec2.7ee9 vagrant mydbname LOG:  could not receive data from client: Connection reset by peer
    

    When I run that query (SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' ORDER BY table_schema,table_name;) in pgAdmin, it returns the list of tables, as expected.

    What is causing this?

    Is there any other information that can be used to troubleshoot?

  • one-click Heroku deploy support

    one-click Heroku deploy support

    So this is semi/totally bullshit, but I figured I'd open the PR for the purpose of further conversation.

    The primary problem is (I think) the vendoring of bindata.go. Obviously idomatic go provides no guidance on how to manage an asset pipeline today, and the popular kr https://github.com/kr/heroku-buildpack-go buildpack doesn't know about how to use your Makefile.

    Adding a Procfile, app.json and vendoring godeps all seem more-or-less reasonable to me.

    Oh, I also stopped checking if there were any tables and crashing if not. pgweb should probably work on empty databases. I mean... why not?

    A logo which isn't your picture for the app.json would be cool too, but with this branch you can hit the deploy button and get a working app.

  • Not able to view text columns

    Not able to view text columns

    Hello,

    Apologies ahead of time if this is not the proper forum but I didn't see any pgweb questions on StackOverflow. I am trying to use pgweb to view the contents of a table with a text column. Anytime I see the results it always displays the results as some numeric value like "41006". All other columns render perfectly. I know the contents are something other than "41006" because the application I am working on renders the contents correctly. I know that the contents of the column are JSON, in case this has any effect.

    Thanks, Rex Sheridan

  • Add AWS RDS instance discovery

    Add AWS RDS instance discovery

    This PR adds the possibility to automatically discover AWS RDS instances and offer them in a dropdown to prefill the host and port fields.

    • discovery is disabled by default
    • region and credentials can be automatically discovered from EC2 metadata or the usualy AWS SDK config methods (~/.aws/config, env variables, ...)
    • in read-only mode the endpoint for RDS clusters returned is the reader endpoint
  • deploy pgweb as a container alongside postgres in a docker-compose setup?

    deploy pgweb as a container alongside postgres in a docker-compose setup?

    Hello! This looks terrific. For my use case, I'd love to run this container alongside my postgres container, link them together, and have pgweb available at some port on my URL. Is that an idea that's been had before?

  • Error: pq: schema

    Error: pq: schema "dbms_alert" does not exist

    > docker run -p 8082:8081 -e DATABASE_URL='postgres://xxxxx:[email protected]:5444/xxxxx?sslmode=disable' sosedoff/pgweb
    Pgweb v0.11.6 (git: 3e4e9c30c947ce1384c49e4257c9a3cc9dc97876) (go: go1.13.7)
    Connecting to server...
    Connected to  
    Checking database objects...
    Error: pq: schema "dbms_alert" does not exist
    

    When I launch without DATABASE_URL and then login to the same db http://localhost:8081/api/objects responds with:

    {"error":"pq: schema \"dbms_alert\" does not exist","status":400}
    

    My other database tool is Intellij IDEA. I don't see dbms_alert in any part of the db object browser in IDEA.

  • CSV Import

    CSV Import

    Hi! I picked up a closed PR #308 for issue #281 and fixed all issues you mentioned. The only problem is that I'm unable to do make text. Make asks password several times and fails. I changed postgres user password, but it didn't help. I guess something is wrong with my setup. Application itself works fine. Still there are not system tests for CSV import, but I'd like to add them only when I'm sure I can run test suite. Can you please elaborate how to set things up?

  • When running a windows client using SSL there are some commands not recognised?

    When running a windows client using SSL there are some commands not recognised?

    Hi,

    I am trying to get this working under Windows 10 using SSL. However when I make a connection I get:

    'sslkey' is not recognized as an internal or external command,
    'sslmode' is not recognized as an internal or external command,
    'sslrootcert' is not recognized as an internal or external command,
    

    On a Windows system where do I get those binaries?

  • SQL export not working

    SQL export not working

    I have pgweb running in Kubernetes locally with a port forward allowing me to access it.

    When I try "Export to SQL" on any random table, it opens up a new tab about:blank. All the other export options do work fine, and open up a popup allowing me to select the download destination.

    Since the other functions work fine, I would expect the SQL export to also work.

    I'm not sure if this bug is specific to my set up, or pgweb in general

  • --ssl disable does not work

    --ssl disable does not work

    Maybe there is something wrong in the syntax, but this does not work

    $ pgweb --ssl disable --url postgres://vc:[email protected]:5432/my_db
    Connecting to server...
    Error: pq: SSL is not enabled on the server
    

    I'm using 0.3.0, Mac OS X

  • Frontend refactor

    Frontend refactor

    Frontend code is seriously dated and needs a fresh rewrite, using some minimalistic js framework.

    A few things to consider:

    • No react
    • No unstable frameworks
    • No bloatware
  • pkg/client/client.go: Add fallback connection information query

    pkg/client/client.go: Add fallback connection information query

    This PR adds a "fallback" query to the connection Info() function in pkg/client/client.go. This "fallback" query is invoked when specific managed postgresql hosts deny queries to specific inet_* postgres functions, such as inet_client_addr(), inet_client_port(), inet_server_addr(), and inet_server_port(). The "fallback" query does not include any network information and is generally safe to run on all postgres environments.

    This PR closes https://github.com/sosedoff/pgweb/issues/574 by enabling support for bit.io (see screenshots below). We suspect that this PR may also unblock other users of pgweb who are trying to connect pgweb to a postgresql instance with restricted function support (e.g. postgres as a service platforms).

    This PR is a rather small delta and should not change any current functionality of pgweb, although if there are any design concerns please let us know. Screen-Shot-2022-10-31-at-8 16 47-AM Screen-Shot-2022-10-31-at-8 17 15-AM

  • Add button to toggle auto-completion in the SQL editor and corresponding configuration option

    Add button to toggle auto-completion in the SQL editor and corresponding configuration option

    When connected to Postgres database with hundreds of thousands of tables or with highly complex structures the auto-completion in the SQL editor makes editing real pain because of editor lags for several seconds due to the generation of the auto-completion lists (I guess). Could you please add a switch to turn the auto-completion on/off and an configuration option for it's default setting (on/off)? Thank you.


    Further proposals: Also, what's somewhat related is that the initial loading of the database structure (in the left pane) blocks the WUI. It would be nice if this was somewhat asynchronous, just indicating somehow that it's not completely loaded yet and progressing to show what's already scanned but in a way it does not block the rest of the WUI (so that one could connect and start typing SQL immeditately without the need to wait until the left pane loads completely). Thank you.

  • Show error message when API is not available

    Show error message when API is not available

    When pgweb is terminated any new request (or a custom query) will never seem to finish, however the backend is gone and we should print out an error message.

Go-Postgresql-Query-Builder - A query builder for Postgresql in Go

Postgresql Query Builder for Go This query builder aims to make complex queries

Nov 17, 2022
Client to import measurements to timestream databases.

Timestream DB Client Client to import measurements to timestream databases. Supported Databases/Services AWS Timestream AWS Timestream Run NewTimestre

Jan 11, 2022
Interactive client for PostgreSQL and MySQL
Interactive client for PostgreSQL and MySQL

dblab Interactive client for PostgreSQL and MySQL. Overview dblab is a fast and lightweight interactive terminal based UI application for PostgreSQL a

Jan 8, 2023
🏋️ dbbench is a simple database benchmarking tool which supports several databases and own scripts

dbbench Table of Contents Description Example Installation Supported Databases Usage Custom Scripts Troubeshooting Development Acknowledgements Descri

Dec 30, 2022
Go package for sharding databases ( Supports every ORM or raw SQL )
Go package for sharding databases ( Supports every ORM or raw SQL )

Octillery Octillery is a Go package for sharding databases. It can use with every OR Mapping library ( xorm , gorp , gorm , dbr ...) implementing data

Dec 16, 2022
Universal command-line interface for SQL databases

usql A universal command-line interface for PostgreSQL, MySQL, Oracle Database, SQLite3, Microsoft SQL Server, and many other databases including NoSQ

Jan 9, 2023
OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.
OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.

OctoSQL OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases, streaming sources and file formats using

Dec 29, 2022
Redis-shake is a tool for synchronizing data between two redis databases. Redis-shake是一个用于在两个redis之间同步数据的工具,满足用户非常灵活的同步、迁移需求。
Redis-shake is a tool for synchronizing data between two redis databases. Redis-shake是一个用于在两个redis之间同步数据的工具,满足用户非常灵活的同步、迁移需求。

RedisShake is mainly used to synchronize data from one redis to another. Thanks to the Douyu's WSD team for the support. 中文文档 English tutorial 中文使用文档

Dec 29, 2022
SQL API is designed to be able to run queries on databases without any configuration by simple HTTP call.

SQL API SQL API is designed to be able to run queries on databases without any configuration by simple HTTP call. The request contains the DB credenti

Dec 2, 2022
Go sqlite3 http vfs: query sqlite databases over http with range headers

sqlite3vfshttp: a Go sqlite VFS for querying databases over http(s) sqlite3vfshttp is a sqlite3 VFS for querying remote databases over http(s). This a

Dec 27, 2022
The open-source collaborative IDE for your databases.
The open-source collaborative IDE for your databases.

The open-source collaborative IDE for your databases in your browser. About Slashbase is an open-source collaborative IDE for your databases in your b

Sep 4, 2022
test ALL the databases

This project is an integration test, testing various Go database drivers (for the database/sql package). To run these tests, in this directory, run:

Dec 12, 2022
Use SQL to instantly query instances, networks, databases, and more from Scaleway. Open source CLI. No DB required.
Use SQL to instantly query instances, networks, databases, and more from Scaleway. Open source CLI. No DB required.

Scaleway Plugin for Steampipe Use SQL to query infrastructure servers, networks, databases and more from your Scaleway project. Get started → Document

Nov 16, 2022
Manage SQL databases, users and grant using kubernetes manifests

SqlOperator Operate sql databases, users and grants. This is a WIP project and should not at all be used in production at this time. Feel free to vali

Nov 28, 2021
Manage Schema for KubeDB managed Databases

schema-manager Manage Schema for KubeDB managed Databases Installation To install KubeDB, please follow the guide here. Using KubeDB Want to learn how

Feb 19, 2022
A go Library for scan database/sql rows to struct、slice、other types. And it support multiple databases connection management

ploto A go Library for scan database/sql rows to struct、slice、other types. And it support multiple databases connection management It's not an ORM. wo

Nov 3, 2022
SQLite extension for accessing other SQL databases

dblite SQLite extension for accessing other SQL databases, in SQLite. Similar to how Postgres Foreign Data Wrappers enable access to other databases i

Dec 23, 2022
Use SQL to query databases, logs and more from PlanetScale

Use SQL to instantly query PlanetScale databases, branches and more. Open source CLI. No DB required.

Sep 30, 2022
This is the code example how to use SQL to query data from any relational databases in Go programming language.

Go with SQL example This is the code example how to use SQL to query data from any relational databases in Go programming language. To start, please m

Mar 12, 2022