Python wrapper for libpg_query
Project description
Python wrapper for libpg_query
Installation
pip install pgparse
Example Usage
The following example shows how to create a dump and then read it in, and iterate through the data of one of the tables.
import pprint
import pgparse
sql = "SELECT * FROM pg_catalog.pg_class WHERE relname = 'foo'"
print('Fingerprint: {}'.format(pgparse.fingerprint(sql)))
print('Normalized: {!r}'.format(pgparse.normalize(sql)))
parsed = pgparse.parse(sql)
pprint.pprint(parsed)
func = """\
CREATE FUNCTION sales_tax(subtotal real) RETURNS real AS $$
BEGIN
RETURN subtotal * 0.06;
END;
$$ LANGUAGE plpgsql;
"""
parsed = pgparse.parse_pgsql(func)
pprint.pprint(parsed)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pgparse-0.1.0.tar.gz
(1.4 MB
view details)
File details
Details for the file pgparse-0.1.0.tar.gz.
File metadata
- Download URL: pgparse-0.1.0.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cd9b2bd99832cf6ff2cef4ac7fa05291dac920c7cdab724b9116ef7a5f3273e
|
|
| MD5 |
47b162ad3d0c4f5c99a3ee006649d7f0
|
|
| BLAKE2b-256 |
abe904068214f5df9da2519de35e9b47b44f1eb0fe6c31a7b1d149fa95844e70
|