Skip to main content

Python wrapper for libpg_query

Project description

Python wrapper for libpg_query

Package Version Code Coverage BSD Documentation Status

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.2.0.tar.gz (1.6 MB view details)

Uploaded Source

File details

Details for the file pgparse-0.2.0.tar.gz.

File metadata

  • Download URL: pgparse-0.2.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for pgparse-0.2.0.tar.gz
Algorithm Hash digest
SHA256 96f1b8ba908c9e6fffb46bd50a98ee5cbc6f312150b7c98f9b30c51d1229586a
MD5 fc927cbca4fdcf8028bc964b61bca0e1
BLAKE2b-256 fbadbd5d52499e0b892f754f7a67216e2fbda5efb5f1ebcf1e9fc79d566bf3b6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page