{"id":15173181,"url":"https://github.com/supabase/pgadmin4","last_synced_at":"2025-10-01T10:31:35.593Z","repository":{"id":46693430,"uuid":"351487015","full_name":"supabase/pgadmin4","owner":"supabase","description":"Mirror of the pgAdmin 4 GIT repo. DO NOT submit pull requests here! Use the pgadmin-hackers@lists.postgresql.org mailing list. Issues should be logged at https://redmine.postgresql.org/projects/pgadmin4.","archived":true,"fork":true,"pushed_at":"2023-04-24T09:07:28.000Z","size":198397,"stargazers_count":12,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"cli-master","last_synced_at":"2025-01-19T19:56:48.648Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.pgadmin.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"pgadmin-org/pgadmin4","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/supabase.png","metadata":{"funding":{"github":["supabase"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null},"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-03-25T15:33:23.000Z","updated_at":"2023-08-14T03:17:36.000Z","dependencies_parsed_at":"2023-09-23T02:47:47.558Z","dependency_job_id":"691b332f-e8bf-48ce-a0e6-19ab00ddc280","html_url":"https://github.com/supabase/pgadmin4","commit_stats":{"total_commits":5165,"total_committers":128,"mean_commits":40.3515625,"dds":0.7668925459825751,"last_synced_commit":"ce8fab18e208a85d5d82e133869665da7277e4c6"},"previous_names":[],"tags_count":69,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase%2Fpgadmin4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase%2Fpgadmin4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase%2Fpgadmin4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase%2Fpgadmin4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/supabase","download_url":"https://codeload.github.com/supabase/pgadmin4/tar.gz/refs/heads/cli-master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234858878,"owners_count":18897829,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-27T10:42:06.957Z","updated_at":"2025-10-01T10:31:31.709Z","avatar_url":"https://github.com/supabase.png","language":"Python","funding_links":["https://github.com/sponsors/supabase"],"categories":[],"sub_categories":[],"readme":"# pgAdmin 4 \n\npgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the\nPostgreSQL (http://www.postgresql.org) database. \n\nIn the following documentation and examples, *$PGADMIN4_SRC/* is used to denote\nthe top-level directory of a copy of the pgAdmin source tree, either from a\ntarball or a git checkout.\n\n## Architecture\n\npgAdmin 4 is written as a web application in Python, using jQuery and Bootstrap\nfor the client side processing and UI. On the server side, Flask is being\nutilised.\n\nAlthough developed using web technologies, pgAdmin 4 can be deployed either on\na web server using a browser, or standalone on a workstation. The runtime/\nsubdirectory contains an NWjs based runtime application intended to allow this,\nwhich will execute the Python server and display the UI.\n\n## Building the Runtime\n\nTo build the runtime, the following packages must be installed:\n\n* NodeJS 12+\n* Yarn\n\nChange into the runtime directory, and run *yarn install*. This will install the\ndependencies required.\n\nIn order to use the runtime in a development environment, you'll need to copy\n*dev_config.json.in* file to *dev_config.json*, and edit the paths to the Python\nexecutable and *pgAdmin.py* file, otherwise the runtime will use the default\npaths it would expect to find in the standard package for your platform.\n\nYou can then execute the runtime by running something like:\n\n```bash\nnode_modules/nw/nwjs/nw .\n```\n\nor on macOS:\n\n```bash\nnode_modules/nw/nwjs/nwjs.app/Contents/MacOS/nwjs .\n```\n\n# Configuring the Python Environment\n\nIn order to run the Python code, a suitable runtime environment is required.\nPython version 3.6 and later are currently supported. It is recommended that a\nPython Virtual Environment is setup for this purpose, rather than using the\nsystem Python environment. On Linux and Mac systems, the process is fairly\nsimple - adapt as required for your distribution:\n\n1. Create a virtual environment in an appropriate directory. The last argument is\n   the name of the environment; that can be changed as desired:\n\n   ```bash\n   $ python3 -m venv venv\n   ```\n   \n2. Now activate the virtual environment:\n\n   ```bash\n   $ source venv/bin/activate\n   ```\n   \n3. Some of the components used by pgAdmin require a very recent version of *pip*,\n   so update that to the latest:\n   \n   ```bash\n   $ pip install --upgrade pip\n   ```\n   \n4. Ensure that a PostgreSQL installation's bin/ directory is in the path (so\n   pg_config can be found for building psycopg2), and install the required\n   packages:\n\n   ```bash\n   (venv) $ PATH=$PATH:/usr/local/pgsql/bin pip install -r $PGADMIN4_SRC/requirements.txt\n   ```\n   \n   If you are planning to run the regression tests, you also need to install\n   additional requirements from web/regression/requirements.txt:\n\n   ```bash\n   (venv) $ pip install -r $PGADMIN4_SRC/web/regression/requirements.txt\n   ```\n   \n5. Create a local configuration file for pgAdmin. Edit\n   $PGADMIN4_SRC/web/config_local.py and add any desired configuration options\n   (use the config.py file as a reference - any settings duplicated in\n   config_local.py will override those in config.py). A typical development\n   configuration may look like:\n   \n    ```python\n    from config import *\n\n    # Debug mode\n    DEBUG = True\n\n    # App mode\n    SERVER_MODE = True\n\n    # Enable the test module\n    MODULE_BLACKLIST.remove('test')\n\n    # Log\n    CONSOLE_LOG_LEVEL = DEBUG\n    FILE_LOG_LEVEL = DEBUG\n\n    DEFAULT_SERVER = '127.0.0.1'\n\n    UPGRADE_CHECK_ENABLED = True\n\n    # Use a different config DB for each server mode.\n    if SERVER_MODE == False:\n        SQLITE_PATH = os.path.join(\n            DATA_DIR,\n            'pgadmin4-desktop.db'\n        )\n    else:\n        SQLITE_PATH = os.path.join(\n            DATA_DIR,\n            'pgadmin4-server.db'\n        )\n   ```\n   \n   This configuration allows easy switching between server and desktop modes\n   for testing.\n\n6. The initial setup of the configuration database is interactive in server\n   mode, and non-interactive in desktop mode. You can run it either by\n   running:\n\n   ```bash\n   (venv) $ python3 $PGADMIN4_SRC/web/setup.py\n   ```\n   \n   or by starting pgAdmin 4:\n\n   ```bash\n   (venv) $ python3 $PGADMIN4_SRC/web/pgAdmin4.py\n   ```\n   \n   Whilst it is possible to automatically run setup in desktop mode by running\n   the runtime, that will not work in server mode as the runtime doesn't allow\n   command line interaction with the setup program.\n\nAt this point you will be able to run pgAdmin 4 from the command line in either\nserver or desktop mode, and access it from a web browser using the URL shown in\nthe terminal once pgAdmin has started up.\n\nSetup of an environment on Windows is somewhat more complicated unfortunately,\nplease see *pkg/win32/README.txt* for complete details.\n\n# Building the Web Assets\n\npgAdmin is dependent on a number of third party Javascript libraries. These,\nalong with it's own Javascript code, SCSS/CSS code and images must be\ncompiled into a \"bundle\" which is transferred to the browser for execution\nand rendering. This is far more efficient than simply requesting each\nasset as it's needed by the client.\n\nTo create the bundle, you will need the 'yarn' package management tool to be\ninstalled. Then, you can run the following commands on a *nix system to\ndownload the required packages and build the bundle:\n\n```bash\n(venv) $ cd $PGADMIN4_SRC\n(venv) $ make install-node\n(venv) $ make bundle\n```\n\nOn Windows systems (where \"make\" is not available), the following commands\ncan be used:\n\n```\nC:\\\u003e cd $PGADMIN4_SRC\\web\nC:\\$PGADMIN4_SRC\\web\u003e yarn install\nC:\\$PGADMIN4_SRC\\web\u003e yarn run bundle\n```\n\n# Creating pgAdmin themes\n\nTo create a pgAdmin theme, you need to create a directory under\n*web/pgadmin/static/scss/resources*.\nCopy the sample file *_theme.variables.scss.sample* to the new directory and\nrename it to *_theme.variables.scss*. Change the desired hexadecimal values of\nthe colors and bundle pgAdmin. You can also add a preview image in the theme\ndirectory with the name as *\\\u003cdir name\u003e_preview.png*. It is recommended that the\npreview image should not be larger in size as it may take time to load on slow\nnetworks. Run the *yarn run bundle* and you're good to go. No other changes are\nrequired, pgAdmin bundle will read the directory and create other required\nentries to make them available in preferences.\n\nThe name of the theme is derived from the directory name. Underscores (_) and\nhyphens (-) will be replaced with spaces and the result will be camel cased.\n\n# Building the documentation\n\nIn order to build the docs, an additional Python package is required in the\nvirtual environment. This can be installed with the pip package manager:\n\n```bash\n$ source venv/bin/activate\n(venv) $ pip install Sphinx\n```\n\nThe docs can then be built using the Makefile in *$PGADMIN4_SRC*, e.g.\n\n```bash\n(venv) $ make docs\n```\n\nThe output can be found in *$PGADMIN4_SRC/docs/en_US/_build/html/index.html*\n\n# Building packages\n\nMost packages can be built using the Makefile in $PGADMIN4_SRC, provided all\nthe setup and configuration above has been completed.\n\nTo build a source tarball:\n\n```bash\n(venv) $ make src\n```\n\nTo build a PIP Wheel, activate either a Python 3 virtual environment, configured \nwith all the required packages, and then run:\n\n```bash\n(venv) $ make pip\n```\n\nTo build the macOS AppBundle, please see *pkg/mac/README*.\n\nTo build the Windows installer, please see *pkg/win32/README.txt*.\n# Create Database Migrations\n\nIn order to make changes to the SQLite DB, navigate to the 'web' directory:\n\n```bash\n(venv) $ cd $PGADMIN4_SRC/web\n```\n\nCreate a migration file with the following command:\n\n```bash\n(venv) $ FLASK_APP=pgAdmin4.py flask db revision\n```\n\nThis will create a file in: $PGADMIN4_SRC/web/migrations/versions/ .\nAdd any changes to the 'upgrade' function.\nIncrement the SCHEMA_VERSION in $PGADMIN4_SRC/web/pgadmin/model/__init__.py file.\n\nThere is no need to increment the SETTINGS_SCHEMA_VERSION.\n\n# Support\n\nSee https://www.pgadmin.org/support/ for support options.\n\n# Project info\n\nThe source code repository can be found here:\n\nhttp://git.postgresql.org/gitweb/?p=pgadmin4.git;a=summary\n\nA Redmine project for pgAdmin 4 can be found at the address below. A PostgreSQL\ncommunity account is required to access this site. Please note that at present\nonly project developers can log bug and feature requests:\n\nhttps://redmine.postgresql.org/projects/pgadmin4\n\nIf you wish to discuss pgAdmin 4, or contribute to the project, please use the\npgAdmin Hackers mailing list:\n\npgadmin-hackers@postgresql.org\n\n\n# CLI Test Suite\n\nThere is a test suite for the CLI diffing tool under the `test_cli/` directory.\n\nRequirements:\n- python 3.8+\n- docker-compose\n\nSetup\n\nIf this is the first time you're working on the project, create and own the subdirectories used by pgadmin4 that require sudo.\n\n```sh\nsudo mkdir /var/lib/pgadmin\nsudo chown -R $USER:$USER /var/lib/pgadmin\nsudo mkdir /var/log/pgadmin\nsudo chown -R $USER:$USER /var/log/pgadmin\n```\n\nCreate a virtual environment and and install dependencies\n```sh\npython -m venv venv\nsource venv/bin/activate\npip install -U pip wheel setuptools\npip install -r requirements.txt\n```\n\nRun the tests\n```sh\npytest test_cli\n```\n\nExample output:\n```text\n============================= test session starts ==============================\nplatform darwin -- Python 3.8.6, pytest-6.2.5, py-1.10.0, pluggy-1.0.0\nrootdir: /Users/wova/Documents/pgadmin4\ncollected 4 items\n\ntest_cli/test_add_table.py .                                             [ 25%]\ntest_cli/test_empty_db_diff.py .                                         [ 50%]\ntest_cli/test_engines.py ..                                              [100%]\n\n============================== 4 passed in 27.37s ==============================\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupabase%2Fpgadmin4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsupabase%2Fpgadmin4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupabase%2Fpgadmin4/lists"}