srikiraju / psqlparse

A python module that gives access to PostgreSQL's query parser, for turning SQL into a parse tree.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

psqlparse

Build Status

This Python module uses the libpg_query to parse SQL queries and return the internal PostgreSQL parsetree.

Installation

pip install psqlparse

Usage

import psqlparse
statements = psqlparse.parse('SELECT * from mytable')
used_tables = statements[0].tables()  # ['my_table']

Development

  1. Install requirements:
pip install -r requirements.txt
  1. Build Cython extension
USE_CYTHON=1 python setup.py build_ext --inplace
  1. Perform changes

  2. Run tests

pytest

Contributors

About

A python module that gives access to PostgreSQL's query parser, for turning SQL into a parse tree.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 99.0%Language:Shell 1.0%