Convert Figma logo to code with AI

pgadmin-org logopgadmin4

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.

2,395
629
2,395
374

Top Related Projects

39,201

Free universal database tool and SQL client

Modern and easy to use SQL client for MySQL, Postgres, SQLite, SQL Server, and more. Linux, MacOS, and Windows.

A simple and lightweight SQL client desktop with cross database and platform support.

A lightweight client for managing MariaDB, MySQL, SQL Server, PostgreSQL, SQLite, Interbase and Firebird, written in Delphi

5,116

Database manager for MySQL, PostgreSQL, SQL Server, MongoDB, SQLite and others. Runs under Windows, Linux, Mac or as web application

Quick Overview

pgAdmin 4 is a comprehensive management and development platform for PostgreSQL databases. It provides a web-based interface for database administration, allowing users to manage multiple servers, databases, and database objects through an intuitive GUI. pgAdmin 4 is designed to meet the needs of both developers and database administrators.

Pros

  • Cross-platform compatibility (Windows, macOS, Linux)
  • Rich feature set for database management and query execution
  • Supports both desktop and web-based deployment
  • Extensible through plugins and custom dashboards

Cons

  • Can be resource-intensive, especially for large databases
  • Learning curve for new users due to the extensive feature set
  • Some users report occasional stability issues
  • Setup process can be complex for web-based deployment

Getting Started

To get started with pgAdmin 4:

  1. Download the installer for your operating system from the official website: https://www.pgadmin.org/download/
  2. Run the installer and follow the on-screen instructions
  3. Launch pgAdmin 4
  4. Click on "Add New Server" in the Quick Links dashboard
  5. Enter your PostgreSQL server details (host, port, username, password)
  6. Click "Save" to connect to your database server

Once connected, you can start managing your PostgreSQL databases through the pgAdmin 4 interface.

Competitor Comparisons

39,201

Free universal database tool and SQL client

Pros of DBeaver

  • Supports a wide range of database systems, including NoSQL databases
  • Offers a more feature-rich interface with advanced data manipulation tools
  • Provides cross-platform compatibility (Windows, macOS, Linux)

Cons of DBeaver

  • Steeper learning curve due to its extensive feature set
  • Can be resource-intensive, especially when handling large datasets
  • Less specialized for PostgreSQL-specific features compared to pgAdmin 4

Code Comparison

DBeaver (Java):

public class PostgreSQLDataSource extends JDBCDataSource {
    @Override
    public DBPDataSourceInfo getInfo() {
        return new PostgreDataSourceInfo(this);
    }
}

pgAdmin 4 (Python):

class PostgreSQLDataSource(BaseDataSource):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.conn = None

    def connect(self):
        self.conn = psycopg2.connect(**self.connection_params)

Both examples show basic data source implementations, but DBeaver uses Java and integrates with its JDBC framework, while pgAdmin 4 uses Python and directly connects using psycopg2 for PostgreSQL.

Modern and easy to use SQL client for MySQL, Postgres, SQLite, SQL Server, and more. Linux, MacOS, and Windows.

Pros of Beekeeper Studio

  • Cross-platform support (Windows, macOS, Linux) with a consistent interface
  • Modern, user-friendly UI with a focus on simplicity and ease of use
  • Built-in query editor with syntax highlighting and auto-completion

Cons of Beekeeper Studio

  • Limited advanced features compared to pgAdmin 4
  • Smaller community and less extensive documentation
  • Fewer supported database types (primarily focuses on MySQL, PostgreSQL, SQLite)

Code Comparison

pgAdmin 4 (Python):

@blueprint.route('/browser/')
@login_required
def index():
    """Render the main browser window."""
    return render_template(MODULE_NAME + '/index.html')

Beekeeper Studio (JavaScript/Vue.js):

export default {
  name: 'TableList',
  computed: {
    ...mapState('data', ['tables']),
    ...mapGetters('data', ['tableList'])
  }
}

Both projects use different technologies for their backend and frontend. pgAdmin 4 is primarily built with Python and uses Flask for its web framework, while Beekeeper Studio is an Electron-based application using Vue.js for its frontend. The code snippets show a basic route handler in pgAdmin 4 and a Vue component in Beekeeper Studio, highlighting their different approaches to building the user interface.

A simple and lightweight SQL client desktop with cross database and platform support.

Pros of Sqlectron GUI

  • Multi-database support: Works with MySQL, PostgreSQL, SQL Server, and more
  • Cross-platform: Available for Windows, macOS, and Linux
  • User-friendly interface with query history and auto-completion features

Cons of Sqlectron GUI

  • Less feature-rich compared to pgAdmin 4's advanced PostgreSQL-specific tools
  • Smaller community and less frequent updates
  • Limited advanced visualization and data analysis capabilities

Code Comparison

Sqlectron GUI (React component):

class DatabaseList extends Component {
  renderDatabaseItem(database) {
    return (
      <li key={database.name}>
        <a onClick={() => this.props.onSelectDatabase(database.name)}>
          {database.name}
        </a>
      </li>
    );
  }
}

pgAdmin 4 (Python backend):

class DatabaseView(PGChildNodeView):
    node_type = blueprint.node_type

    parent_ids = [
        {'type': 'int', 'id': 'gid'},
        {'type': 'int', 'id': 'sid'}
    ]
    ids = [
        {'type': 'int', 'id': 'did'}
    ]

Both projects use different technologies and architectures, with Sqlectron GUI focusing on a cross-platform Electron-based application, while pgAdmin 4 utilizes a web-based interface with a Python backend.

A lightweight client for managing MariaDB, MySQL, SQL Server, PostgreSQL, SQLite, Interbase and Firebird, written in Delphi

Pros of HeidiSQL

  • Lightweight and faster performance, especially for large databases
  • Supports multiple database systems (MySQL, MariaDB, PostgreSQL, MS SQL)
  • User-friendly interface with intuitive design

Cons of HeidiSQL

  • Limited advanced features compared to pgAdmin 4
  • Less extensive documentation and community support
  • Primarily Windows-focused, with limited cross-platform compatibility

Code Comparison

HeidiSQL (SQL query execution):

SELECT * FROM table_name
WHERE condition
ORDER BY column_name;

pgAdmin 4 (SQL query execution):

SELECT * FROM table_name
WHERE condition
ORDER BY column_name;

Both tools use standard SQL syntax for query execution, so the code comparison is identical in this case. The main differences lie in the user interface and additional features rather than the core SQL functionality.

HeidiSQL is a lightweight, multi-database management tool with a focus on simplicity and speed. It's particularly well-suited for Windows users who need to work with various database systems. pgAdmin 4, on the other hand, is a more comprehensive tool specifically designed for PostgreSQL, offering advanced features and cross-platform compatibility at the cost of increased resource usage and complexity.

5,116

Database manager for MySQL, PostgreSQL, SQL Server, MongoDB, SQLite and others. Runs under Windows, Linux, Mac or as web application

Pros of DBGate

  • Supports multiple database types (MySQL, PostgreSQL, SQL Server, MongoDB, etc.)
  • Offers a modern, user-friendly interface with dark mode
  • Provides built-in data analysis and visualization tools

Cons of DBGate

  • Less mature and established compared to pgAdmin 4
  • Smaller community and potentially fewer resources for support
  • May lack some advanced PostgreSQL-specific features

Code Comparison

DBGate (JavaScript):

import { SqlDumper } from 'dbgate-tools';

const dumper = new SqlDumper();
dumper.putCmd("CREATE TABLE test (id int)");
console.log(dumper.s);

pgAdmin 4 (Python):

from pgadmin.utils.driver import get_driver

driver = get_driver('psycopg2')
connection = driver.connect()
cursor = connection.cursor()
cursor.execute("CREATE TABLE test (id int)")

Both projects offer database management capabilities, but DBGate provides a more versatile solution for multiple database types with a modern interface. pgAdmin 4, being PostgreSQL-specific, offers deeper integration and potentially more advanced features for PostgreSQL databases. The code examples demonstrate the different approaches and languages used in each project.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

pgAdmin 4

pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.

In the following documentation and examples, $PGADMIN4_SRC/ is used to denote the top-level directory of a copy of the pgAdmin source tree, either from a tarball or a git checkout.

Architecture

pgAdmin 4 is written as a web application with Python(Flask) on the server side and ReactJS, HTML5 with CSS for the client side processing and UI.

Although developed using web technologies, pgAdmin 4 can be deployed either on a web server using a browser, or standalone on a workstation. The runtime/ subdirectory contains an Electron based runtime application intended to allow this, which will execute the Python server and display the UI.

Building the Runtime

To build the runtime, the following packages must be installed:

  • NodeJS 16+
  • Yarn

Change into the runtime directory, and run yarn install. This will install the dependencies required.

In order to use the runtime in a development environment, you'll need to copy dev_config.json.in file to dev_config.json, and edit the paths to the Python executable and pgAdmin.py file, otherwise the runtime will use the default paths it would expect to find in the standard package for your platform.

You can then execute the runtime by running something like:

yarn run start

Configuring the Python Environment

In order to run the Python code, a suitable runtime environment is required. Python version 3.7 and later are currently supported. It is recommended that a Python Virtual Environment is setup for this purpose, rather than using the system Python environment. On Linux and Mac systems, the process is fairly simple - adapt as required for your distribution:

  1. Create a virtual environment in an appropriate directory. The last argument is the name of the environment; that can be changed as desired:

    $ python3 -m venv venv
    
  2. Now activate the virtual environment:

    $ source venv/bin/activate
    
  3. Some of the components used by pgAdmin require a very recent version of pip, so update that to the latest:

    $ pip install --upgrade pip
    
  4. Ensure that a PostgreSQL installation's bin/ directory is in the path (so pg_config can be found for building psycopg3), and install the required packages:

    (venv) $ PATH=$PATH:/usr/local/pgsql/bin pip install -r $PGADMIN4_SRC/requirements.txt
    

    If you are planning to run the regression tests, you also need to install additional requirements from web/regression/requirements.txt:

    (venv) $ pip install -r $PGADMIN4_SRC/web/regression/requirements.txt
    
  5. Create a local configuration file for pgAdmin. Edit $PGADMIN4_SRC/web/config_local.py and add any desired configuration options (use the config.py file as a reference - any settings duplicated in config_local.py will override those in config.py). A typical development configuration may look like:

    from config import *
    
    # Debug mode
    DEBUG = True
    
    # App mode
    SERVER_MODE = True
    
    # Enable the test module
    MODULE_BLACKLIST.remove('test')
    
    # Log
    CONSOLE_LOG_LEVEL = DEBUG
    FILE_LOG_LEVEL = DEBUG
    
    DEFAULT_SERVER = '127.0.0.1'
    
    UPGRADE_CHECK_ENABLED = True
    
    # Use a different config DB for each server mode.
    if SERVER_MODE == False:
        SQLITE_PATH = os.path.join(
            DATA_DIR,
            'pgadmin4-desktop.db'
        )
    else:
        SQLITE_PATH = os.path.join(
            DATA_DIR,
            'pgadmin4-server.db'
        )
    

    This configuration allows easy switching between server and desktop modes for testing.

  6. The initial setup of the configuration database is interactive in server mode, and non-interactive in desktop mode. You can run it either by running:

    (venv) $ python3 $PGADMIN4_SRC/web/setup.py
    

    or by starting pgAdmin 4:

    (venv) $ python3 $PGADMIN4_SRC/web/pgAdmin4.py
    

    Whilst it is possible to automatically run setup in desktop mode by running the runtime, that will not work in server mode as the runtime doesn't allow command line interaction with the setup program.

At this point you will be able to run pgAdmin 4 from the command line in either server or desktop mode, and access it from a web browser using the URL shown in the terminal once pgAdmin has started up.

Setup of an environment on Windows is somewhat more complicated unfortunately, please see pkg/win32/README.txt for complete details.

Building the Web Assets

pgAdmin is dependent on a number of third party Javascript libraries. These, along with it's own Javascript code, SCSS/CSS code and images must be compiled into a "bundle" which is transferred to the browser for execution and rendering. This is far more efficient than simply requesting each asset as it's needed by the client.

To create the bundle, you will need the 'yarn' package management tool to be installed. Then, you can run the following commands on a *nix system to download the required packages and build the bundle:

(venv) $ cd $PGADMIN4_SRC
(venv) $ make install-node
(venv) $ make bundle

On Windows systems (where "make" is not available), the following commands can be used:

C:\> cd $PGADMIN4_SRC\web
C:\$PGADMIN4_SRC\web> yarn install
C:\$PGADMIN4_SRC\web> yarn run bundle

Creating pgAdmin themes

To create a pgAdmin theme, you need to create a directory under web/pgadmin/static/scss/resources. Copy the sample file _theme.variables.scss.sample to the new directory and rename it to _theme.variables.scss. Change the desired hexadecimal values of the colors and bundle pgAdmin. You can also add a preview image in the theme directory with the name as <dir name>_preview.png. It is recommended that the preview image should not be larger in size as it may take time to load on slow networks. Run the yarn run bundle and you're good to go. No other changes are required, pgAdmin bundle will read the directory and create other required entries to make them available in preferences.

The name of the theme is derived from the directory name. Underscores (_) and hyphens (-) will be replaced with spaces and the result will be camel cased.

Building the documentation

In order to build the docs, an additional Python package is required in the virtual environment. This can be installed with the pip package manager:

$ source venv/bin/activate
(venv) $ pip install Sphinx
(venv) $ pip install sphinxcontrib-youtube

The docs can then be built using the Makefile in $PGADMIN4_SRC, e.g.

(venv) $ make docs

The output can be found in $PGADMIN4_SRC/docs/en_US/_build/html/index.html

Building packages

Most packages can be built using the Makefile in $PGADMIN4_SRC, provided all the setup and configuration above has been completed.

To build a source tarball:

(venv) $ make src

To build a PIP Wheel, activate either a Python 3 virtual environment, configured with all the required packages, and then run:

(venv) $ make pip

To build the macOS AppBundle, please see pkg/mac/README.

To build the Windows installer, please see pkg/win32/README.txt.

Create Database Migrations

In order to make changes to the SQLite DB, navigate to the 'web' directory:

(venv) $ cd $PGADMIN4_SRC/web

Create a migration file with the following command:

(venv) $ FLASK_APP=pgAdmin4.py flask db revision

This will create a file in: $PGADMIN4_SRC/web/migrations/versions/ . Add any changes to the 'upgrade' function. Increment the SCHEMA_VERSION in $PGADMIN4_SRC/web/pgadmin/model/init.py file.

There is no need to increment the SETTINGS_SCHEMA_VERSION.

Support

See https://www.pgadmin.org/support/ for support options.

Security Issues

If you would like to report a security issue with pgAdmin, please email security (at) pgadmin (dot) org.

Note that this address should only be used for reporting security issues that you believe you've found in the design or code of pgAdmin, pgAgent, and the pgAdmin website. It should not be used to ask security questions.

Project info

A GitHub project for pgAdmin 4 can be found at the address below:

https://github.com/pgadmin-org/pgadmin4

Please submit any changes as Pull Requests against the master branch of the pgadmin-org/pgadmin4 repository.

If you wish to discuss pgAdmin 4, or contribute to the project, please use the pgAdmin Hackers mailing list:

pgadmin-hackers@postgresql.org