$npx skillfedfor your agent

pglast

PostgreSQL Languages AST and statements prettifier

With conditionsPyPI UtilitiesReleased Jul 20264.8M downloads / moGPL-3.0-or-laterPlatform wheel

Decision gist · record as of 2026-08-14

platform wheels — pglast-8.4-cp310-cp310-macosx_10_9_x86_64.whl · pglast-8.4-cp310-cp310-macosx_11_0_arm64.whl · pglast-8.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
v8.4 · released 2026-07-22

Yes, if you need to parse and inspect PostgreSQL SQL statements programmatically. The package is actively maintained, has no runtime dependencies, and covers modern Python versions. The GPL-3.0-or-later license is a blocker only if you cannot open-source derivative works; otherwise, it's a solid choice for SQL analysis tasks.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Medium install friction due to compiled wheels for multiple platforms and Python versions (3.10–3.14).
  • Active maintenance with recent release 23 days ago and 402 repository stars suggests stable, ongoing support.

License · maintenance · safety

GPL-3.0-or-later (copyleft) — Licensed under GPL-3.0-or-later (copyleft). Use in proprietary software requires careful review of your licensing obligations, as derivative works must also be open-source under compatible terms.

last release 2026-07-22 (23 days) · last repo commit 2026-08-13 · 402 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,822,899 downloads/mo, #2,220 on PyPI

Verify before relying

pip install pglast

import pglast

ast = pglast.parse('SELECT * FROM table')
print(pglast.prettify(ast))
  • Minimum Python version requirement (classifiers list 3.10–3.14 but requires_python is unspecified)
  • Whether the package works with all PostgreSQL versions or requires a specific server version
  • Performance characteristics when parsing very large or complex SQL statements
Same gist for agents: .md · .json

What it is and what it does

pglast is a Python module that wraps the PostgreSQL parser (via libpg_query) to expose SQL statements as an abstract syntax tree. It lets you programmatically inspect the structure of SQL queries—their clauses, expressions, and relationships—rather than treating them as opaque strings. The tree is built from interconnected nodes that mirror PostgreSQL's internal parse representation.

The package is typically used to analyze, validate, or transform SQL statements without executing them. Common tasks include extracting table and column references, detecting query patterns, reformatting SQL for readability, or building tools that need to understand query structure. It has no runtime dependencies and covers modern Python versions; installation requires compiled wheels for your platform.

Use it for

  • Extract table and column names from arbitrary SQL queries for dependency analysis or schema mapping
  • Reformat or prettify SQL statements to a consistent style for code review or documentation
  • Build linters or validators that check SQL queries for anti-patterns or compliance rules
  • Analyze query structure to optimize or rewrite statements programmatically
  • Generate documentation or diagrams of data lineage from SQL statement trees

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need to parse and inspect PostgreSQL SQL statements programmatically.

The package is actively maintained, has no runtime dependencies, and covers modern Python versions. The GPL-3.0-or-later license is a blocker only if you cannot open-source derivative works; otherwise, it's a solid choice for SQL analysis tasks.

Install

pglast on PyPI

Before you install

Medium install friction due to compiled wheels for multiple platforms and Python versions (3.10–3.14). Active maintenance with recent release 23 days ago and 402 repository stars suggests stable, ongoing support.

License in practice

Licensed under GPL-3.0-or-later (copyleft). Use in proprietary software requires careful review of your licensing obligations, as derivative works must also be open-source under compatible terms.

Quickstart

pip install pglast

import pglast

ast = pglast.parse('SELECT * FROM table')
print(pglast.prettify(ast))

Verify before relying

  • Minimum Python version requirement (classifiers list 3.10–3.14 but requires_python is unspecified)
  • Whether the package works with all PostgreSQL versions or requires a specific server version
  • Performance characteristics when parsing very large or complex SQL statements

Package facts

LicenseGPL-3.0-or-later copyleft
Python supportNot specified
Install frictionMedium. Platform-specific wheel
Runtime dependenciesNone
MaintenanceActively maintained 23 days since the last release
Last repo commit
First released
Downloads4,822,899 / month, #2,220 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: SQLTopic :: DatabaseTopic :: Utilities

Evidence: pglast-8.4-cp310-cp310-macosx_10_9_x86_64.whl; pglast-8.4-cp310-cp310-macosx_11_0_arm64.whl; pglast-8.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pglast-8.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pglast-8.4-cp310-cp310-musllinux_1_2_aarch64.whl; pglast-8.4-cp310-cp310-musllinux_1_2_x86_64.whl; pglast-8.4-cp310-cp310-win32.whl; pglast-8.4-cp310-cp310-win_amd64.whl; pglast-8.4-cp311-cp311-macosx_10_9_x86_64.whl; pglast-8.4-cp311-cp311-macosx_11_0_arm64.whl; pglast-8.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pglast-8.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pglast-8.4-cp311-cp311-musllinux_1_2_aarch64.whl; pglast-8.4-cp311-cp311-musllinux_1_2_x86_64.whl; pglast-8.4-cp311-cp311-win32.whl; pglast-8.4-cp311-cp311-win_amd64.whl; pglast-8.4-cp312-cp312-macosx_10_13_x86_64.whl; pglast-8.4-cp312-cp312-macosx_11_0_arm64.whl; pglast-8.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pglast-8.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Tags

Capabilities
postgresql sql parserparse sql statementssql ast treepostgresql query analysissql prettifierpostgres statement parsersql syntax tree
Topics
sql-parsingpostgres-toolsast-analysis
PyPI keywords
postgresqlparsersqlprettifier

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “postgresql sql parser”

  • pglastParses PostgreSQL SQL statements into an abstract syntax tree and…
  • ddlparseParses CREATE TABLE DDL statements from MySQL, MariaDB, PostgreSQL,…
  • pgsanityPgSanity validates PostgreSQL SQL syntax by wrapping the ecpg parser,…

Give your agent the search over MCP, or paste the wish link into any chat.

More Utilities packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
charset-normalizer Worth it
PyPI · Utilities · released Aug 2026

Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.

permissive licensepure Python · 3.7+
1.7Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
Pygments Worth it
PyPI · Utilities · released Mar 2026

Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.

Install it if you need to display or transform source code.

BSD-2-Clausepure Python · 3.9+
1.3Bdownloads / mo
six With conditions
PyPI · Libraries · released Dec 2024

Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.

MITpure Python
1.2Bdownloads / mo

See also fparser · sqlparse · pgsanity · collate-sqllineage · fugue-sql-antlr · sqloxide · sqlglot · sqllineage · schemainspect · tree-sitter-sql