Skip to content

pgrubic#

pgrubic PyPI - Version PyPI - Status PyPI - License PyPI - Python Version CI Coverage badge DOC release PyPI Total Downloads CodeQL

A PostgreSQL linter and formatter for schema migrations and design best practices.

Features#

  • Over 100+ rules
  • Automatic violation correction (e.g., automatically add concurrently to index create statements)
  • River style code formatting for DML statements
  • Almost identical stying with pg_dump for DDL statements
  • Python 3.12+ compatibility
  • Automatic caching to avoid reformatting unchanged files
  • Violations suppression, statement level, and file level

Requirements#

Pgrubic is built upon the shoulders of:

  • pglast - Python bindings to libpg_query
  • libpg_query - PostgreSQL parser outside of the server environment