This Python module uses the libpg_query to parse SQL queries and return the internal PostgreSQL parsetree.
pip install psqlparse
import psqlparse
statements = psqlparse.parse('SELECT * from mytable')
used_tables = statements[0].tables() # ['my_table']
tables
is only available from version 1.0rc1
- Update dependencies
git submodule update --init
- Install requirements:
pip install -r requirements.txt
- Build Cython extension
USE_CYTHON=1 python setup.py build_ext --inplace
-
Perform changes
-
Run tests
pytest