Awesome
psqlparse2
Python wrapper for libpg_query.
Inspired by psqlparse, which was authored by alculquicondor
Overview
Python protobuf types are generated from libpg_query/protobuf/pg_query.proto
.
See gen_proto
in Makefile for details.
Additionally, a Cython wrapper with Python bindings for certain functions
from libpg_query
is provided. For example, there are wrappers for pg_query_parse_protobuf
and
pg_query_deparse_protobuf
, which allow converting between SQL strings and parse trees encoded as protobufs.
This snippet
demonstrates how psqlparse2
can be used to convert a SQL function into a parse tree,
and then manipulate the parse tree before converting it back into a SQL string.
Installation
pip install psqlparse2